Information Technology Reference
In-Depth Information
Figure 16-9. Expect versus should form
More Serverspec Resources
Common code can be moved to a file called spec_helper.rb . We only have one file with tests
in our example, but imagine there are multiple files. Create a spec_helper.rb as shown in
Example 16-5 . Notice that the file contains the first two lines from default_spec.rb . Those
lines would need to be repeated in every file that contains tests.
Example 16-5. chefdk/apache-test/test/integration/default/serverspec/spec_helper.rb
require 'serverspec'
set :backend , :exec
Now that you have a spec_helper.rb file, modify default_spec.rb to use the spec_helper .
Change the require statement and remove the set line, as shown in Example 16-6 .
Example 16-6. chefdk/apache-test/test/integration/default/serverspec/default_spec.rb
require 'spec_helper'
describe 'web site' ddo
it 'responds on port 80' ddo
Search WWH ::




Custom Search