diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2018-09-25 22:33:30 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2018-09-25 22:33:30 -0700 |
commit | 9fb62cda391591e0369ce32b8c8ec1afd3dfb8af (patch) | |
tree | ddfda448b6b63e88da8ed2e865a29311c18538bf /spec/unit | |
parent | 671a1a740209a021fd31f451ec233bd884a5a37f (diff) | |
download | chef-9fb62cda391591e0369ce32b8c8ec1afd3dfb8af.tar.gz |
Work around rspec 3.8.0 issues
Problem is described in detail here:
https://github.com/rspec/rspec-expectations/issues/1068#issuecomment-424580564
Note that this is self-inflicted damage and our pattern of having #to_hash
on objects be called by #to_json and to produce a serialized 'flavor' of
the object breaks what ruby's semantics are supposed to be and those
should all be `#to_h` methods, and we should deprecate `#to_hash` but I
imagine that will be a reasonably large breaking change (Although
hopefully most of the use by users will be Node#to_hash which is
entirely correct usage since that thing is actually a kind of glorified
Hash-like monster).
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec/unit')
-rw-r--r-- | spec/unit/run_context/child_run_context_spec.rb | 6 | ||||
-rw-r--r-- | spec/unit/shell/shell_session_spec.rb | 5 |
2 files changed, 6 insertions, 5 deletions
diff --git a/spec/unit/run_context/child_run_context_spec.rb b/spec/unit/run_context/child_run_context_spec.rb index 47a6c84f7a..be45aaa1cc 100644 --- a/spec/unit/run_context/child_run_context_spec.rb +++ b/spec/unit/run_context/child_run_context_spec.rb @@ -2,7 +2,7 @@ # Author:: Adam Jacob (<adam@chef.io>) # Author:: Tim Hinderliter (<tim@chef.io>) # Author:: Christopher Walters (<cw@chef.io>) -# Copyright:: Copyright 2008-2016, Chef Software Inc. +# Copyright:: Copyright 2008-2018, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -55,8 +55,8 @@ describe Chef::RunContext::ChildRunContext do expect(child.resource_collection.object_id).not_to eq run_context.resource_collection.object_id f = Chef::Resource::File.new("hi", child) child.resource_collection.insert(f) - expect(child.resource_collection).to include f - expect(run_context.resource_collection).not_to include f + expect(child.resource_collection.include?(f)).to be true + expect(run_context.resource_collection.include?(f)).to be false end it "immediate_notification_collection is not the same as the parent" do diff --git a/spec/unit/shell/shell_session_spec.rb b/spec/unit/shell/shell_session_spec.rb index ce66676196..2e32e6547d 100644 --- a/spec/unit/shell/shell_session_spec.rb +++ b/spec/unit/shell/shell_session_spec.rb @@ -204,7 +204,7 @@ describe Shell::SoloLegacySession do allow(@session).to receive(:node_built?).and_return(true) kitteh = Chef::Resource::Cat.new("keyboard") @recipe.run_context.resource_collection << kitteh - expect(@session.resource_collection).to include(kitteh) + expect(@session.resource_collection.include?(kitteh)).to be true end it "returns definitions from its compilation object" do @@ -224,7 +224,8 @@ describe Shell::SoloLegacySession do keyboard_cat = Chef::Resource::Cat.new("keyboard_cat") @recipe.run_context.resource_collection << keyboard_cat # @session.rebuild_collection - expect(@session.resource_collection).to include(kitteh_cat, keyboard_cat) + expect(@session.resource_collection.include?(kitteh_cat)).to be true + expect(@session.resource_collection.include?(keyboard_cat)).to be true end it "runs chef with a resource collection from the compiled cookbooks" do |