diff options
-rw-r--r-- | lib/chef/resource/apt_update.rb | 2 | ||||
-rw-r--r-- | spec/unit/resource/apt_update_spec.rb | 42 |
2 files changed, 18 insertions, 26 deletions
diff --git a/lib/chef/resource/apt_update.rb b/lib/chef/resource/apt_update.rb index df2033b063..1a25ec2ef5 100644 --- a/lib/chef/resource/apt_update.rb +++ b/lib/chef/resource/apt_update.rb @@ -22,7 +22,7 @@ class Chef class Resource class AptUpdate < Chef::Resource resource_name :apt_update - provides :apt_update, os: "linux" + provides :apt_update property :frequency, Integer, default: 86_400 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 |