summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2016-11-07 14:22:33 -0800
committerTim Smith <tsmith@chef.io>2016-11-07 14:22:33 -0800
commitb24a63950c48c39a64707b127849220a64e8b8ee (patch)
treeeabeba03c9ea17eaf1c140677329ef871c073c53 /spec
parent1d61e460675a540536bd4fc893b4bc6aa7070f21 (diff)
downloadchef-b24a63950c48c39a64707b127849220a64e8b8ee.tar.gz
Prevent apt_update failures on non-Linux platformstas50/apt_update_fails
We 1/2 wired up the noop functionality, but specifying that we only provided the resource on Linux caused that code to never run. This prevents this sort of error on non-Linux platforms: ``` Cannot find a resource for apt_update on windows version 6.3.9600 ``` Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/resource/apt_update_spec.rb42
1 files changed, 17 insertions, 25 deletions
diff --git a/spec/unit/resource/apt_update_spec.rb b/spec/unit/resource/apt_update_spec.rb
index a7d2c64fee..dd72b18063 100644
--- a/spec/unit/resource/apt_update_spec.rb
+++ b/spec/unit/resource/apt_update_spec.rb
@@ -24,35 +24,27 @@ describe Chef::Resource::AptUpdate do
let(:run_context) { Chef::RunContext.new(node, {}, events) }
let(:resource) { Chef::Resource::AptUpdate.new("update", run_context) }
- context "on linux", :linux_only do
- it "should create a new Chef::Resource::AptUpdate" do
- expect(resource).to be_a_kind_of(Chef::Resource)
- expect(resource).to be_a_kind_of(Chef::Resource::AptUpdate)
- end
-
- it "the default frequency should be 1 day" do
- expect(resource.frequency).to eql(86_400)
- end
+ it "should create a new Chef::Resource::AptUpdate" do
+ expect(resource).to be_a_kind_of(Chef::Resource)
+ expect(resource).to be_a_kind_of(Chef::Resource::AptUpdate)
+ end
- it "the frequency should accept integers" do
- resource.frequency(400)
- expect(resource.frequency).to eql(400)
- end
+ it "the default frequency should be 1 day" do
+ expect(resource.frequency).to eql(86_400)
+ end
- it "should resolve to a Noop class when apt-get is not found" do
- expect(Chef::Provider::AptUpdate).to receive(:which).with("apt-get").and_return(false)
- expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::Noop)
- end
+ it "the frequency should accept integers" do
+ resource.frequency(400)
+ expect(resource.frequency).to eql(400)
+ end
- it "should resolve to a AptUpdate class when apt-get is found" do
- expect(Chef::Provider::AptUpdate).to receive(:which).with("apt-get").and_return(true)
- expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::AptUpdate)
- end
+ it "should resolve to a Noop class when apt-get is not found" do
+ expect(Chef::Provider::AptUpdate).to receive(:which).with("apt-get").and_return(false)
+ expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::Noop)
end
- context "on windows", :windows_only do
- it "should resolve to a NoOp provider" do
- expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::Noop)
- end
+ it "should resolve to a AptUpdate class when apt-get is found" do
+ expect(Chef::Provider::AptUpdate).to receive(:which).with("apt-get").and_return(true)
+ expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::AptUpdate)
end
end