diff options
author | Tim Smith <tsmith@chef.io> | 2017-08-10 18:04:04 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-10 18:04:04 -0700 |
commit | 852c947ebef363241268e67d3cf9186531016723 (patch) | |
tree | b7fade9a43bae371aab0455439de6cb175633c6c | |
parent | e0b4a4c4e7095b554855e8b27ac6ed4749fe8cf8 (diff) | |
parent | fe5e560ccd8990104922ba2fe364b45221b5aaf5 (diff) | |
download | chef-852c947ebef363241268e67d3cf9186531016723.tar.gz |
Merge pull request #6318 from chef/zypper2
Maintain compat with old zypper_repo resource used in cookbooks
-rw-r--r-- | lib/chef/resource/zypper_repository.rb | 2 | ||||
-rw-r--r-- | spec/unit/resource/zypper_repository_spec.rb | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/lib/chef/resource/zypper_repository.rb b/lib/chef/resource/zypper_repository.rb index cce09ec83c..11db8642b2 100644 --- a/lib/chef/resource/zypper_repository.rb +++ b/lib/chef/resource/zypper_repository.rb @@ -22,7 +22,7 @@ class Chef class Resource 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) |