diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-03-22 07:47:03 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2016-03-22 07:47:03 -0700 |
commit | c3470696029d86dd5ca9eb4880f69c5d7261c6bd (patch) | |
tree | 615a9c2e9e9dc7ce3f2fa367879335d1c8d0835f /spec | |
parent | 585347304b926228fc4e3c67c4a1941207695421 (diff) | |
parent | 83f692967c50cbca1bb25f89d11923de8c4058be (diff) | |
download | chef-c3470696029d86dd5ca9eb4880f69c5d7261c6bd.tar.gz |
Merge pull request #4732 from chef/lcg/use-inline-resources-core
allow use_inline_resources for core chef providers
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/lwrp_spec.rb | 2 | ||||
-rw-r--r-- | spec/unit/provider/apt_update_spec.rb | 20 |
2 files changed, 11 insertions, 11 deletions
diff --git a/spec/unit/lwrp_spec.rb b/spec/unit/lwrp_spec.rb index 6eba001af4..6574a91f13 100644 --- a/spec/unit/lwrp_spec.rb +++ b/spec/unit/lwrp_spec.rb @@ -754,7 +754,7 @@ describe "LWRP" do it "lets you extend the recipe DSL" do expect(Chef::Recipe).to receive(:include).with(MyAwesomeDSLExensionClass) - expect(Chef::Provider::InlineResources).to receive(:include).with(MyAwesomeDSLExensionClass) + expect(Chef::Resource::ActionClass).to receive(:include).with(MyAwesomeDSLExensionClass) Chef::DSL::Recipe.send(:include, MyAwesomeDSLExensionClass) end diff --git a/spec/unit/provider/apt_update_spec.rb b/spec/unit/provider/apt_update_spec.rb index b72f7d9a76..3e3e6ba07a 100644 --- a/spec/unit/provider/apt_update_spec.rb +++ b/spec/unit/provider/apt_update_spec.rb @@ -44,19 +44,19 @@ describe Chef::Provider::AptUpdate do context "when the apt config directory does not exist" do before do FileUtils.rmdir config_dir - expect(File.exist?(config_dir)).to be_falsey - allow(provider).to receive(:shell_out!).with("apt-get -q update") + expect(File.exist?(config_dir)).to be false + allow_any_instance_of(Chef::Provider::Execute).to receive(:shell_out!).with("apt-get -q update", anything()) end it "should create the directory" do provider.run_action(:update) - expect(File.exist?(config_dir)).to be_truthy - expect(File.directory?(config_dir)).to be_truthy + expect(File.exist?(config_dir)).to be true + expect(File.directory?(config_dir)).to be true end it "should create the config file" do provider.run_action(:update) - expect(File.exist?(config_file)).to be_truthy + expect(File.exist?(config_file)).to be true expect(File.read(config_file)).to match(/^APT::Update.*#{stamp_dir}/) end end @@ -64,7 +64,7 @@ describe Chef::Provider::AptUpdate do describe "#action_update" do it "should update the apt cache" do provider.load_current_resource - expect(provider).to receive(:shell_out!).with("apt-get -q update").and_return(double) + expect_any_instance_of(Chef::Provider::Execute).to receive(:shell_out!).with("apt-get -q update", anything()) provider.run_action(:update) expect(new_resource).to be_updated_by_last_action end @@ -78,14 +78,14 @@ describe Chef::Provider::AptUpdate do it "should run if the time stamp is old" do expect(File).to receive(:mtime).with("#{stamp_dir}/update-success-stamp").and_return(Time.now - 86_500) - expect(provider).to receive(:shell_out!).with("apt-get -q update") + expect_any_instance_of(Chef::Provider::Execute).to receive(:shell_out!).with("apt-get -q update", anything()) provider.run_action(:periodic) expect(new_resource).to be_updated_by_last_action end it "should not run if the time stamp is new" do expect(File).to receive(:mtime).with("#{stamp_dir}/update-success-stamp").and_return(Time.now) - expect(provider).to_not receive(:shell_out!).with("apt-get -q update") + expect_any_instance_of(Chef::Provider::Execute).not_to receive(:shell_out!).with("apt-get -q update", anything()) provider.run_action(:periodic) expect(new_resource).to_not be_updated_by_last_action end @@ -97,14 +97,14 @@ describe Chef::Provider::AptUpdate do it "should run if the time stamp is old" do expect(File).to receive(:mtime).with("#{stamp_dir}/update-success-stamp").and_return(Time.now - 500) - expect(provider).to receive(:shell_out!).with("apt-get -q update") + expect_any_instance_of(Chef::Provider::Execute).to receive(:shell_out!).with("apt-get -q update", anything()) provider.run_action(:periodic) expect(new_resource).to be_updated_by_last_action end it "should not run if the time stamp is new" do expect(File).to receive(:mtime).with("#{stamp_dir}/update-success-stamp").and_return(Time.now - 300) - expect(provider).to_not receive(:shell_out!).with("apt-get -q update") + expect_any_instance_of(Chef::Provider::Execute).not_to receive(:shell_out!).with("apt-get -q update", anything()) provider.run_action(:periodic) expect(new_resource).to_not be_updated_by_last_action end |