summaryrefslogtreecommitdiff
path: root/spec/unit/resource/apt_update_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/resource/apt_update_spec.rb')
-rw-r--r--spec/unit/resource/apt_update_spec.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/spec/unit/resource/apt_update_spec.rb b/spec/unit/resource/apt_update_spec.rb
index 8015cb03b3..6fcba4adce 100644
--- a/spec/unit/resource/apt_update_spec.rb
+++ b/spec/unit/resource/apt_update_spec.rb
@@ -19,8 +19,10 @@
require "spec_helper"
describe Chef::Resource::AptUpdate do
-
- let(:resource) { Chef::Resource::AptUpdate.new("update") }
+ let(:node) { Chef::Node.new }
+ let(:events) { Chef::EventDispatch::Dispatcher.new }
+ let(:run_context) { Chef::RunContext.new(node, {}, events) }
+ let(:resource) { Chef::Resource::AptUpdate.new("update", run_context) }
it "should create a new Chef::Resource::AptUpdate" do
expect(resource).to be_a_kind_of(Chef::Resource)
@@ -35,4 +37,14 @@ describe Chef::Resource::AptUpdate do
resource.frequency(400)
expect(resource.frequency).to eql(400)
end
+
+ it "should resolve to a Noop class when uses_apt? is false" do
+ expect(Chef::Provider::AptUpdate).to receive(:uses_apt?).and_return(false)
+ expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::Noop)
+ end
+
+ it "should resolve to a AptUpdate class when uses_apt? is true" do
+ expect(Chef::Provider::AptUpdate).to receive(:uses_apt?).and_return(true)
+ expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::AptUpdate)
+ end
end