summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2017-08-10 15:12:22 -0700
committerTim Smith <tsmith@chef.io>2017-08-10 15:12:22 -0700
commit5bba6797f63866b168fd9c6b0370994010c147a7 (patch)
treeb79bdb04e8edac80b3c81935f590184dd7b3324c /spec
parent87a613bbc2603dab378cef904b749a1978cf9c74 (diff)
downloadchef-5bba6797f63866b168fd9c6b0370994010c147a7.tar.gz
Maintain compat with old zypper_repo resource used in cookbookszypper2
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/resource/zypper_repository_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/unit/resource/zypper_repository_spec.rb b/spec/unit/resource/zypper_repository_spec.rb
index d5a3a663d3..16951d071c 100644
--- a/spec/unit/resource/zypper_repository_spec.rb
+++ b/spec/unit/resource/zypper_repository_spec.rb
@@ -30,6 +30,22 @@ describe Chef::Resource::ZypperRepository do
expect(resource).to be_a_kind_of(Chef::Resource::ZypperRepository)
end
+ it "should have a name of repo-source" do
+ expect(resource.name).to eql("repo-source")
+ end
+
+ it "should have a default action of create" do
+ expect(resource.action).to eql([:create])
+ end
+
+ it "supports all valid actions" do
+ expect { resource.action :add }.not_to raise_error
+ expect { resource.action :remove }.not_to raise_error
+ expect { resource.action :create }.not_to raise_error
+ expect { resource.action :refresh }.not_to raise_error
+ expect { resource.action :delete }.to raise_error(ArgumentError)
+ end
+
it "should resolve to a Noop class when zypper is not found" do
expect(Chef::Provider::ZypperRepository).to receive(:which).with("zypper").and_return(false)
expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::Noop)