summaryrefslogtreecommitdiff
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
parent87a613bbc2603dab378cef904b749a1978cf9c74 (diff)
downloadchef-zypper2.tar.gz
Maintain compat with old zypper_repo resource used in cookbookszypper2
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/resource/zypper_repository.rb1
-rw-r--r--spec/unit/resource/zypper_repository_spec.rb16
2 files changed, 17 insertions, 0 deletions
diff --git a/lib/chef/resource/zypper_repository.rb b/lib/chef/resource/zypper_repository.rb
index cce09ec83c..2ebcfdaae0 100644
--- a/lib/chef/resource/zypper_repository.rb
+++ b/lib/chef/resource/zypper_repository.rb
@@ -23,6 +23,7 @@ class Chef
class ZypperRepository < Chef::Resource
resource_name :zypper_repository
provides :zypper_repository
+ provides :zypper_repo
property :repo_name, String, name_property: true
property :description, String
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)