diff options
Diffstat (limited to 'spec/integration')
-rw-r--r-- | spec/integration/client/client_spec.rb | 18 | ||||
-rw-r--r-- | spec/integration/knife/chef_fs_data_store_spec.rb | 8 | ||||
-rw-r--r-- | spec/integration/knife/common_options_spec.rb | 6 | ||||
-rw-r--r-- | spec/integration/knife/cookbook_api_ipv6_spec.rb | 4 | ||||
-rw-r--r-- | spec/integration/knife/deps_spec.rb | 8 | ||||
-rw-r--r-- | spec/integration/knife/diff_spec.rb | 12 | ||||
-rw-r--r-- | spec/integration/knife/download_spec.rb | 10 | ||||
-rw-r--r-- | spec/integration/knife/list_spec.rb | 4 | ||||
-rw-r--r-- | spec/integration/knife/raw_spec.rb | 10 | ||||
-rw-r--r-- | spec/integration/knife/serve_spec.rb | 2 | ||||
-rw-r--r-- | spec/integration/knife/show_spec.rb | 6 | ||||
-rw-r--r-- | spec/integration/knife/upload_spec.rb | 36 | ||||
-rw-r--r-- | spec/integration/recipes/lwrp_inline_resources_spec.rb | 2 | ||||
-rw-r--r-- | spec/integration/solo/solo_spec.rb | 20 |
14 files changed, 73 insertions, 73 deletions
diff --git a/spec/integration/client/client_spec.rb b/spec/integration/client/client_spec.rb index 0144ae0ce3..f4bb124781 100644 --- a/spec/integration/client/client_spec.rb +++ b/spec/integration/client/client_spec.rb @@ -44,7 +44,7 @@ EOM it 'should fail when cwd is below high above and paths are not specified' do result = shell_out("#{chef_client} -z -o 'x::default' --disable-config", :cwd => File.expand_path('..', path_to(''))) - result.exitstatus.should == 1 + expect(result.exitstatus).to eq(1) end end @@ -54,7 +54,7 @@ EOM it 'should load .chef/knife.rb when -z is specified' do result = shell_out("#{chef_client} -z -o 'x::default'", :cwd => path_to('')) # FATAL: Configuration error NoMethodError: undefined method `xxx' for nil:NilClass - result.stdout.should include("xxx") + expect(result.stdout).to include("xxx") end end @@ -135,8 +135,8 @@ EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" #{path_to('arbitrary.rb')} #{path_to('arbitrary2.rb')}", :cwd => chef_dir) result.error! - IO.read(path_to('tempfile.txt')).should == '1' - IO.read(path_to('tempfile2.txt')).should == '2' + expect(IO.read(path_to('tempfile.txt'))).to eq('1') + expect(IO.read(path_to('tempfile2.txt'))).to eq('2') end it "should run recipes specified as relative paths directly on the command line" do @@ -155,7 +155,7 @@ EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" arbitrary.rb", :cwd => path_to('')) result.error! - IO.read(path_to('tempfile.txt')).should == '1' + expect(IO.read(path_to('tempfile.txt'))).to eq('1') end it "should run recipes specified directly on the command line AFTER recipes in the run list" do @@ -179,7 +179,7 @@ EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o x::constant_definition arbitrary.rb", :cwd => path_to('')) result.error! - IO.read(path_to('tempfile.txt')).should == '1' + expect(IO.read(path_to('tempfile.txt'))).to eq('1') end end @@ -211,7 +211,7 @@ cookbook_path "#{path_to('cookbooks')}" EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --local-mode", :cwd => chef_dir) - result.stdout.should_not include("SSL validation of HTTPS requests is disabled.") + expect(result.stdout).not_to include("SSL validation of HTTPS requests is disabled.") result.error! end @@ -232,8 +232,8 @@ cookbook_path "#{path_to('cookbooks')}" EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -r 'x::default' -z", :cwd => chef_dir) - result.stdout.should_not include("Overridden Run List") - result.stdout.should include("Run List is [recipe[x::default]]") + expect(result.stdout).not_to include("Overridden Run List") + expect(result.stdout).to include("Run List is [recipe[x::default]]") #puts result.stdout result.error! end diff --git a/spec/integration/knife/chef_fs_data_store_spec.rb b/spec/integration/knife/chef_fs_data_store_spec.rb index a4d62673de..eb02db5384 100644 --- a/spec/integration/knife/chef_fs_data_store_spec.rb +++ b/spec/integration/knife/chef_fs_data_store_spec.rb @@ -180,9 +180,9 @@ EOM knife('list --local /users').should_succeed "/users/x.json\n" end - it 'After knife raw -z -i rolestuff.json -m PUT /roles/x, the output is pretty', :pending => (RUBY_VERSION < "1.9") do + it 'After knife raw -z -i rolestuff.json -m PUT /roles/x, the output is pretty', :skip => (RUBY_VERSION < "1.9") do knife("raw -z -i #{path_to('rolestuff.json')} -m PUT /roles/x").should_succeed( /"x"/ ) - IO.read(path_to('roles/x.json')).should == <<EOM.strip + expect(IO.read(path_to('roles/x.json'))).to eq <<EOM.strip { "name": "x", "description": "hi there" @@ -246,9 +246,9 @@ EOM knife('list --local /users').should_succeed "/users/z.json\n" end - it 'After knife raw -z -i rolestuff.json -m POST /roles, the output is pretty', :pending => (RUBY_VERSION < "1.9") do + it 'After knife raw -z -i rolestuff.json -m POST /roles, the output is pretty', :skip => (RUBY_VERSION < "1.9") do knife("raw -z -i #{path_to('rolestuff.json')} -m POST /roles").should_succeed( /uri/ ) - IO.read(path_to('roles/x.json')).should == <<EOM.strip + expect(IO.read(path_to('roles/x.json'))).to eq <<EOM.strip { "name": "x", "description": "hi there" diff --git a/spec/integration/knife/common_options_spec.rb b/spec/integration/knife/common_options_spec.rb index dfc1e024f9..ec76738b6f 100644 --- a/spec/integration/knife/common_options_spec.rb +++ b/spec/integration/knife/common_options_spec.rb @@ -39,7 +39,7 @@ describe 'knife common options', :workstation do it 'knife raw /nodes/x should retrieve the node' do knife('raw /nodes/x').should_succeed( /"name": "x"/ ) - Chef::Config.chef_server_url.should == 'http://localhost:9999' + expect(Chef::Config.chef_server_url).to eq('http://localhost:9999') end end @@ -101,7 +101,7 @@ EOM it 'knife raw -z --chef-zero-port=9999 /nodes/x retrieves the node' do knife('raw -z --chef-zero-port=9999 /nodes/x').should_succeed( /"name": "x"/ ) - Chef::Config.chef_server_url.should == 'http://localhost:9999' + expect(Chef::Config.chef_server_url).to eq('http://localhost:9999') end context 'when the default port (8889) is already bound' do @@ -149,7 +149,7 @@ EOM it 'knife raw -z --chef-zero-port=9999 /nodes/x retrieves the node' do knife('raw -z --chef-zero-port=9999 /nodes/x').should_succeed( /"name": "x"/ ) - Chef::Config.chef_server_url.should == 'http://localhost:9999' + expect(Chef::Config.chef_server_url).to eq('http://localhost:9999') end end end diff --git a/spec/integration/knife/cookbook_api_ipv6_spec.rb b/spec/integration/knife/cookbook_api_ipv6_spec.rb index e59c8912bd..3d468be7f6 100644 --- a/spec/integration/knife/cookbook_api_ipv6_spec.rb +++ b/spec/integration/knife/cookbook_api_ipv6_spec.rb @@ -92,7 +92,7 @@ END_CLIENT_RB shell_out!("#{knife} cookbook upload apache2 #{knife_config_flag}", :cwd => chef_dir) versions_list_json = Chef::HTTP::Simple.new("http://[::1]:8900").get("/cookbooks/apache2", "accept" => "application/json") versions_list = Chef::JSONCompat.from_json(versions_list_json) - versions_list["apache2"]["versions"].should_not be_empty + expect(versions_list["apache2"]["versions"]).not_to be_empty end context "and the cookbook has been uploaded to the server" do @@ -102,7 +102,7 @@ END_CLIENT_RB it "downloads the cookbook" do shell_out!("knife cookbook download apache2 #{knife_config_flag} -d #{cache_path}", :cwd => chef_dir) - Dir["#{cache_path}/*"].map {|entry| File.basename(entry)}.should include("apache2-0.0.1") + expect(Dir["#{cache_path}/*"].map {|entry| File.basename(entry)}).to include("apache2-0.0.1") end end diff --git a/spec/integration/knife/deps_spec.rb b/spec/integration/knife/deps_spec.rb index 8b4d71906b..3120db4940 100644 --- a/spec/integration/knife/deps_spec.rb +++ b/spec/integration/knife/deps_spec.rb @@ -251,8 +251,8 @@ EOM end it 'knife deps --tree prints each once' do knife('deps --tree /roles/foo.json /roles/self.json') do - stdout.should == "/roles/foo.json\n /roles/bar.json\n /roles/baz.json\n /roles/foo.json\n/roles/self.json\n /roles/self.json\n" - stderr.should == "WARNING: No knife configuration file found\n" + expect(stdout).to eq("/roles/foo.json\n /roles/bar.json\n /roles/baz.json\n /roles/foo.json\n/roles/self.json\n /roles/self.json\n") + expect(stderr).to eq("WARNING: No knife configuration file found\n") end end end @@ -589,8 +589,8 @@ EOM end it 'knife deps --tree prints each once' do knife('deps --remote --tree /roles/foo.json /roles/self.json') do - stdout.should == "/roles/foo.json\n /roles/bar.json\n /roles/baz.json\n /roles/foo.json\n/roles/self.json\n /roles/self.json\n" - stderr.should == "WARNING: No knife configuration file found\n" + expect(stdout).to eq("/roles/foo.json\n /roles/bar.json\n /roles/baz.json\n /roles/foo.json\n/roles/self.json\n /roles/self.json\n") + expect(stderr).to eq("WARNING: No knife configuration file found\n") end end end diff --git a/spec/integration/knife/diff_spec.rb b/spec/integration/knife/diff_spec.rb index c12ebbcf8f..465383437f 100644 --- a/spec/integration/knife/diff_spec.rb +++ b/spec/integration/knife/diff_spec.rb @@ -247,7 +247,7 @@ EOM end when_the_chef_server 'has an environment with a different value' do before { environment 'x', { 'description' => 'hi' } } - it 'knife diff reports the difference', :pending => (RUBY_VERSION < "1.9") do + it 'knife diff reports the difference', :skip => (RUBY_VERSION < "1.9") do knife('diff /environments/x.json').should_succeed(/ { - "name": "x", @@ -277,7 +277,7 @@ EOM environment 'x', {} end - it 'knife diff reports the difference', :pending => (RUBY_VERSION < "1.9") do + it 'knife diff reports the difference', :skip => (RUBY_VERSION < "1.9") do knife('diff /environments/x.json').should_succeed(/ { - "name": "x" @@ -291,7 +291,7 @@ EOM before do environment 'x', { 'description' => 'lo' } end - it 'knife diff reports the difference', :pending => (RUBY_VERSION < "1.9") do + it 'knife diff reports the difference', :skip => (RUBY_VERSION < "1.9") do knife('diff /environments/x.json').should_succeed(/ { "name": "x", @@ -533,7 +533,7 @@ EOM end when_the_chef_server 'has an environment with a different value' do before { environment 'x', { 'description' => 'hi' } } - it 'knife diff reports the difference', :pending => (RUBY_VERSION < "1.9") do + it 'knife diff reports the difference', :skip => (RUBY_VERSION < "1.9") do knife('diff /environments/x.json').should_succeed(/ { - "name": "x", @@ -560,7 +560,7 @@ EOM end when_the_chef_server 'has an environment with no value' do before { environment 'x', {} } - it 'knife diff reports the difference', :pending => (RUBY_VERSION < "1.9") do + it 'knife diff reports the difference', :skip => (RUBY_VERSION < "1.9") do knife('diff /environments/x.json').should_succeed(/ { - "name": "x" @@ -574,7 +574,7 @@ EOM before do environment 'x', { 'description' => 'lo' } end - it 'knife diff reports the difference', :pending => (RUBY_VERSION < "1.9") do + it 'knife diff reports the difference', :skip => (RUBY_VERSION < "1.9") do knife('diff /environments/x.json').should_succeed(/ { "name": "x", diff --git a/spec/integration/knife/download_spec.rb b/spec/integration/knife/download_spec.rb index 0c2b907f1e..cf1e4fcf0f 100644 --- a/spec/integration/knife/download_spec.rb +++ b/spec/integration/knife/download_spec.rb @@ -1073,15 +1073,15 @@ EOM # Check that BasicClient.request() always gets called with X-OPS-USERID original_new = Chef::HTTP::BasicClient.method(:new) - Chef::HTTP::BasicClient.should_receive(:new) do |args| + expect(Chef::HTTP::BasicClient).to receive(:new) { |args| new_result = original_new.call(*args) original_request = new_result.method(:request) - new_result.should_receive(:request) do |method, url, body, headers, &response_handler| - headers['X-OPS-USERID'].should_not be_nil + expect(new_result).to receive(:request) { |method, url, body, headers, &response_handler| + expect(headers['X-OPS-USERID']).not_to be_nil original_request.call(method, url, body, headers, &response_handler) - end.at_least(:once) + }.at_least(:once) new_result - end.at_least(:once) + }.at_least(:once) knife('download /cookbooks/x').should_succeed <<EOM Created /cookbooks diff --git a/spec/integration/knife/list_spec.rb b/spec/integration/knife/list_spec.rb index 3d8b83001d..911b56ef18 100644 --- a/spec/integration/knife/list_spec.rb +++ b/spec/integration/knife/list_spec.rb @@ -471,7 +471,7 @@ EOM end end - when_the_repository 'has a cookbooks directory and a symlinked cookbooks directory', :pending => (Chef::Platform.windows?) do + when_the_repository 'has a cookbooks directory and a symlinked cookbooks directory', :skip => (Chef::Platform.windows?) do before do directory 'cookbooks' symlink 'symlinked', 'cookbooks' @@ -508,7 +508,7 @@ EOM end end - when_the_repository 'has a real_cookbooks directory and a cookbooks symlink to it', :pending => (Chef::Platform.windows?) do + when_the_repository 'has a real_cookbooks directory and a cookbooks symlink to it', :skip => (Chef::Platform.windows?) do before do directory 'real_cookbooks' symlink 'cookbooks', 'real_cookbooks' diff --git a/spec/integration/knife/raw_spec.rb b/spec/integration/knife/raw_spec.rb index 2b49d2ebb2..75fc8fa55e 100644 --- a/spec/integration/knife/raw_spec.rb +++ b/spec/integration/knife/raw_spec.rb @@ -38,7 +38,7 @@ describe 'knife raw', :workstation do user 'x', '{}' end - it 'knife raw /nodes/x returns the node', :pending => (RUBY_VERSION < "1.9") do + it 'knife raw /nodes/x returns the node', :skip => (RUBY_VERSION < "1.9") do knife('raw /nodes/x').should_succeed <<EOM { "name": "x", @@ -68,7 +68,7 @@ EOM knife('raw /blarghle').should_fail(/ERROR: Server responded with error 404 "Not Found\s*"/) end - it 'knife raw -m DELETE /roles/x succeeds', :pending => (RUBY_VERSION < "1.9") do + it 'knife raw -m DELETE /roles/x succeeds', :skip => (RUBY_VERSION < "1.9") do knife('raw -m DELETE /roles/x').should_succeed <<EOM { "name": "x", @@ -92,7 +92,7 @@ EOM knife('show /roles/x.json').should_fail "ERROR: /roles/x.json: No such file or directory\n" end - it 'knife raw -m PUT -i blah.txt /roles/x succeeds', :pending => (RUBY_VERSION < "1.9") do + it 'knife raw -m PUT -i blah.txt /roles/x succeeds', :skip => (RUBY_VERSION < "1.9") do Tempfile.open('raw_put_input') do |file| file.write <<EOM { @@ -146,7 +146,7 @@ EOM end end - it 'knife raw -m POST -i blah.txt /roles succeeds', :pending => (RUBY_VERSION < "1.9") do + it 'knife raw -m POST -i blah.txt /roles succeeds', :skip => (RUBY_VERSION < "1.9") do Tempfile.open('raw_put_input') do |file| file.write <<EOM { @@ -196,7 +196,7 @@ EOM @raw_server_thread.kill if @raw_server_thread end - it 'knife raw /blah returns the prettified json', :pending => (RUBY_VERSION < "1.9") do + it 'knife raw /blah returns the prettified json', :skip => (RUBY_VERSION < "1.9") do knife('raw /blah').should_succeed <<EOM { "x": "y", diff --git a/spec/integration/knife/serve_spec.rb b/spec/integration/knife/serve_spec.rb index 3c859b794e..dd3fa5c0d1 100644 --- a/spec/integration/knife/serve_spec.rb +++ b/spec/integration/knife/serve_spec.rb @@ -42,7 +42,7 @@ describe 'knife serve', :workstation do Chef::Config.node_name = nil Chef::Config.client_key = nil api = Chef::ServerAPI.new - api.get('nodes/x')['name'].should == 'x' + expect(api.get('nodes/x')['name']).to eq('x') rescue if exception raise exception diff --git a/spec/integration/knife/show_spec.rb b/spec/integration/knife/show_spec.rb index bc7f1cf6d3..8f1887e738 100644 --- a/spec/integration/knife/show_spec.rb +++ b/spec/integration/knife/show_spec.rb @@ -76,7 +76,7 @@ EOM } EOM end - it 'knife show /environments/x.json shows the remote version', :pending => (RUBY_VERSION < "1.9") do + it 'knife show /environments/x.json shows the remote version', :skip => (RUBY_VERSION < "1.9") do knife('show /environments/x.json').should_succeed <<EOM /environments/x.json: { @@ -92,7 +92,7 @@ EOM } EOM end - it 'knife show /roles/x.json shows the remote version', :pending => (RUBY_VERSION < "1.9") do + it 'knife show /roles/x.json shows the remote version', :skip => (RUBY_VERSION < "1.9") do knife('show /roles/x.json').should_succeed <<EOM /roles/x.json: { @@ -135,7 +135,7 @@ EOM 'name' => 'x' } end - it 'knife show shows the attributes in a predetermined order', :pending => (RUBY_VERSION < "1.9") do + it 'knife show shows the attributes in a predetermined order', :skip => (RUBY_VERSION < "1.9") do knife('show /environments/x.json').should_succeed <<EOM /environments/x.json: { diff --git a/spec/integration/knife/upload_spec.rb b/spec/integration/knife/upload_spec.rb index dade476889..cef4f54e97 100644 --- a/spec/integration/knife/upload_spec.rb +++ b/spec/integration/knife/upload_spec.rb @@ -262,7 +262,7 @@ Created /data_bags/x/y.json EOM knife('diff --name-status /data_bags').should_succeed <<EOM EOM - Chef::JSONCompat.parse(knife('raw /data/x/y').stdout, :create_additions => false).keys.sort.should == [ 'foo', 'id' ] + expect(Chef::JSONCompat.parse(knife('raw /data/x/y').stdout, :create_additions => false).keys.sort).to eq([ 'foo', 'id' ]) end it 'knife upload /data_bags/x /data_bags/x/y.json uploads x once' do @@ -286,9 +286,9 @@ Created /data_bags/x/y.json EOM knife('diff --name-status /data_bags').should_succeed '' result = Chef::JSONCompat.parse(knife('raw /data/x/y').stdout, :create_additions => false) - result.keys.sort.should == [ 'chef_type', 'data_bag', 'id' ] - result['chef_type'].should == 'aaa' - result['data_bag'].should == 'bbb' + expect(result.keys.sort).to eq([ 'chef_type', 'data_bag', 'id' ]) + expect(result['chef_type']).to eq('aaa') + expect(result['data_bag']).to eq('bbb') end end @@ -1268,8 +1268,8 @@ Created /nodes/x.json Updated /org.json Created /roles/x.json EOM - api.get('association_requests').map { |a| a['username'] }.should == [ 'foo' ] - api.get('users').map { |a| a['user']['username'] }.should == [ 'bar' ] + expect(api.get('association_requests').map { |a| a['username'] }).to eq([ 'foo' ]) + expect(api.get('users').map { |a| a['user']['username'] }).to eq([ 'bar' ]) end end @@ -1280,7 +1280,7 @@ EOM it 'knife upload / emits a warning for bar and adds foo and foobar' do knife('upload /').should_succeed '' - api.get('/')['full_name'].should == 'Something' + expect(api.get('/')['full_name']).to eq('Something') end end @@ -1291,7 +1291,7 @@ EOM it 'knife upload / emits a warning for bar and adds foo and foobar' do knife('upload /').should_succeed "Updated /org.json\n" - api.get('/')['full_name'].should == 'Something Else' + expect(api.get('/')['full_name']).to eq('Something Else') end end @@ -1306,8 +1306,8 @@ EOM it 'knife upload / emits a warning for bar and invites foobar' do knife('upload /').should_succeed "Updated /invitations.json\n", :stderr => "WARN: Could not invite bar to organization foo: User bar is already in organization foo\n" - api.get('association_requests').map { |a| a['username'] }.should == [ 'foo', 'foobar' ] - api.get('users').map { |a| a['user']['username'] }.should == [ 'bar' ] + expect(api.get('association_requests').map { |a| a['username'] }).to eq([ 'foo', 'foobar' ]) + expect(api.get('users').map { |a| a['user']['username'] }).to eq([ 'bar' ]) end end @@ -1318,8 +1318,8 @@ EOM it 'knife upload / emits a warning for bar and adds foo and foobar' do knife('upload /').should_succeed "Updated /members.json\n" - api.get('association_requests').map { |a| a['username'] }.should == [ ] - api.get('users').map { |a| a['user']['username'] }.should == [ 'bar', 'foo', 'foobar' ] + expect(api.get('association_requests').map { |a| a['username'] }).to eq([ ]) + expect(api.get('users').map { |a| a['user']['username'] }).to eq([ 'bar', 'foo', 'foobar' ]) end end @@ -1331,8 +1331,8 @@ EOM it 'knife upload / does nothing' do knife('upload /').should_succeed '' - api.get('association_requests').map { |a| a['username'] }.should == [ 'foo' ] - api.get('users').map { |a| a['user']['username'] }.should == [ 'bar' ] + expect(api.get('association_requests').map { |a| a['username'] }).to eq([ 'foo' ]) + expect(api.get('users').map { |a| a['user']['username'] }).to eq([ 'bar' ]) end end end @@ -1347,8 +1347,8 @@ EOM it 'knife upload / does nothing' do knife('upload /').should_succeed '' - api.get('association_requests').map { |a| a['username'] }.should == [ 'bar', 'foo' ] - api.get('users').map { |a| a['user']['username'] }.should == [ ] + expect(api.get('association_requests').map { |a| a['username'] }).to eq([ 'bar', 'foo' ]) + expect(api.get('users').map { |a| a['user']['username'] }).to eq([ ]) end end end @@ -1363,8 +1363,8 @@ EOM it 'knife upload / does nothing' do knife('upload /').should_succeed '' - api.get('association_requests').map { |a| a['username'] }.should == [ ] - api.get('users').map { |a| a['user']['username'] }.should == [ 'bar', 'foo' ] + expect(api.get('association_requests').map { |a| a['username'] }).to eq([ ]) + expect(api.get('users').map { |a| a['user']['username'] }).to eq([ 'bar', 'foo' ]) end end end diff --git a/spec/integration/recipes/lwrp_inline_resources_spec.rb b/spec/integration/recipes/lwrp_inline_resources_spec.rb index a0c13da6f7..a3baba8b0f 100644 --- a/spec/integration/recipes/lwrp_inline_resources_spec.rb +++ b/spec/integration/recipes/lwrp_inline_resources_spec.rb @@ -71,7 +71,7 @@ EOM (up to date) EOM expected = expected.lines.map { |l| l.chomp }.join("\n") - actual.should include(expected) + expect(actual).to include(expected) result.error! end end diff --git a/spec/integration/solo/solo_spec.rb b/spec/integration/solo/solo_spec.rb index 793789b754..cc9ba1abb2 100644 --- a/spec/integration/solo/solo_spec.rb +++ b/spec/integration/solo/solo_spec.rb @@ -28,7 +28,7 @@ file_cache_path "#{path_to('config/cache')}" EOM result = shell_out("ruby bin/chef-solo -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug", :cwd => chef_dir) result.error! - result.stdout.should include("ITWORKS") + expect(result.stdout).to include("ITWORKS") end it "should evaluate its node.json file" do @@ -43,7 +43,7 @@ E result = shell_out("ruby bin/chef-solo -c \"#{path_to('config/solo.rb')}\" -j '#{path_to('config/node.json')}' -l debug", :cwd => chef_dir) result.error! - result.stdout.should include("ITWORKS") + expect(result.stdout).to include("ITWORKS") end end @@ -63,8 +63,8 @@ cookbook_path "#{path_to('cookbooks')}" file_cache_path "#{path_to('config/cache')}" EOM result = shell_out("ruby bin/chef-solo -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug", :cwd => chef_dir) - result.exitstatus.should == 0 # For CHEF-5120 this becomes 1 - result.stdout.should include("WARN: MissingCookbookDependency") + expect(result.exitstatus).to eq(0) # For CHEF-5120 this becomes 1 + expect(result.stdout).to include("WARN: MissingCookbookDependency") end end @@ -91,7 +91,7 @@ file_cache_path "#{path_to('config/cache')}" EOM # We have a timeout protection here so that if due to some bug # run_lock gets stuck we can discover it. - lambda { + expect { Timeout.timeout(120) do chef_dir = File.join(File.dirname(__FILE__), "..", "..", "..") @@ -109,7 +109,7 @@ EOM Process.waitpid(s1) Process.waitpid(s2) end - }.should_not raise_error + }.not_to raise_error # Unfortunately file / directory helpers in integration tests # are implemented using before(:each) so we need to do all below @@ -117,13 +117,13 @@ EOM run_log = File.read(path_to('logs/runs.log')) # both of the runs should succeed - run_log.lines.reject {|l| !l.include? "INFO: Chef Run complete in"}.length.should == 2 + expect(run_log.lines.reject {|l| !l.include? "INFO: Chef Run complete in"}.length).to eq(2) # second run should have a message which indicates it's waiting for the first run pid_lines = run_log.lines.reject {|l| !l.include? "Chef-client pid:"} - pid_lines.length.should == 2 + expect(pid_lines.length).to eq(2) pids = pid_lines.map {|l| l.split(" ").last} - run_log.should include("Chef client #{pids[0]} is running, will wait for it to finish and then run.") + expect(run_log).to include("Chef client #{pids[0]} is running, will wait for it to finish and then run.") # second run should start after first run ends starts = [ ] @@ -135,7 +135,7 @@ EOM ends << index end end - starts[1].should > ends[0] + expect(starts[1]).to be > ends[0] end end |