github.com/go-chef/chef@v0.30.1/test_chef_server/test/integration/default/inspec/cookbook_spec.rb (about)

     1  # Inspec tests for the cookbook chef api go module
     2  #
     3  describe command('/go/src/github.com/go-chef/chef/testapi/bin/cookbook') do
     4    its('stderr') do
     5      should match(%r{^Issue getting cookbook nothere: GET https://testhost/organizations/test/cookbooks/nothere: 404})
     6    end
     7    its('stderr') { should_not match(/error|no such file|cannot find|not used|undefined/) }
     8    its('stderr') { should_not match(/testbook/) }
     9    its('stderr') { should_not match(/sampbook/) }
    10    its('stderr') { should_not match(/Issue loading/) }
    11    its('stdout') do
    12      should match(%r{^List initial cookbooks (?=.*sampbook => https://testhost/organizations/test/cookbooks/sampbook\n\s*\* 0.2.0)(?=.*testbook => https://testhost/organizations/test/cookbooks/testbook\n\s*\* 0.2.0).*EndInitialList}m)
    13    end
    14    # output from get cookbook is odd
    15    its('stdout') { should match(/^Get cookbook testbook/) }
    16    its('stdout') do
    17      should match(%r{^Get cookbook versions testbook testbook => https://testhost/organizations/test/cookbooks/testbook\n\s*\* 0.2.0\n\s*\* 0.1.0}m)
    18    end
    19    its('stdout') do
    20      should match(%r{^Get cookbook versions sampbook sampbook => https://testhost/organizations/test/cookbooks/sampbook\n\s*\* 0.2.0\n\s*\* 0.1.0}m)
    21    end
    22    its('stdout') { should match(/^Get specific cookbook version testbook {CookbookName:testbook/) }
    23    its('stdout') { should match(/^Get all recipes \[sampbook testbook\]/) }
    24    its('stdout') { should match(/^Delete testbook 0.1.0 <nil>/) }
    25    its('stdout') do
    26      should match(%r{^Final cookbook list sampbook => https://testhost/organizations/test/cookbooks/sampbook\n\s*\* 0.2.0}m)
    27    end
    28    its('stdout') do
    29      should match(%r{^Final cookbook versions sampbook sampbook => https://testhost/organizations/test/cookbooks/sampbook\n\s*\* 0.2.0\n\s*\* 0.1.0}m)
    30    end
    31  end