diff options
author | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-09-14 10:50:29 -0700 |
---|---|---|
committer | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-09-14 10:50:29 -0700 |
commit | a300e22d486df119b5588ca28d13f21e5cdb7353 (patch) | |
tree | d7c05ae55a2f91e1eaa149e1551a4667ce9407c5 | |
parent | 5d4dd15ced791b49ec571cfd21ad3ae2afe6b132 (diff) | |
parent | d5ec7382e5587e7f4fed61287a77cfa1e10747a4 (diff) | |
download | chef-a300e22d486df119b5588ca28d13f21e5cdb7353.tar.gz |
Merge pull request #3918 from chef/jdm/fix-mixlib-shellout
Fix failing specs on Windows
-rw-r--r-- | spec/support/shared/unit/provider/file.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/spec/support/shared/unit/provider/file.rb b/spec/support/shared/unit/provider/file.rb index 7de9698451..ff9e271a0a 100644 --- a/spec/support/shared/unit/provider/file.rb +++ b/spec/support/shared/unit/provider/file.rb @@ -465,11 +465,13 @@ shared_examples_for Chef::Provider::File do t } - let(:verification) { double("Verification") } + let(:verification) { instance_double(Chef::Resource::File::Verification) } + let(:verification_fail) { instance_double(Chef::Resource::File::Verification) } context "with user-supplied verifications" do it "calls #verify on each verification with tempfile path" do - allow(Chef::Resource::File::Verification).to receive(:new).and_return(verification) + allow(Chef::Resource::File::Verification).to( + receive(:new).with(anything(), "true", anything()).and_return(verification)) provider.new_resource.verify "true" provider.new_resource.verify "true" expect(verification).to receive(:verify).with(tempfile.path).twice.and_return(true) @@ -477,10 +479,14 @@ shared_examples_for Chef::Provider::File do end it "raises an exception if any verification fails" do + allow(Chef::Resource::File::Verification).to( + receive(:new).with(anything(), "true", anything()).and_return(verification)) + allow(Chef::Resource::File::Verification).to( + receive(:new).with(anything(), "false", anything()).and_return(verification_fail)) provider.new_resource.verify "true" provider.new_resource.verify "false" - allow(verification).to receive(:verify).with("true").and_return(true) - allow(verification).to receive(:verify).with("false").and_return(false) + expect(verification).to receive(:verify).with(tempfile.path).and_return(true) + expect(verification_fail).to receive(:verify).with(tempfile.path).and_return(false) expect{provider.send(:do_validate_content)}.to raise_error(Chef::Exceptions::ValidationFailed) end end |