summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorbyplayer <byplayer100@gmail.com>2021-07-21 21:46:47 +0900
committerbyplayer <byplayer100@gmail.com>2021-07-21 21:46:47 +0900
commit436ee6c984e6626082779d8c89d10d357081b8bf (patch)
tree178a271015c1c094f35662346a12a7fd7e15fa15 /spec
parent6d44ea1df5914f067c346c2a9de8512407988a6a (diff)
downloadchef-436ee6c984e6626082779d8c89d10d357081b8bf.tar.gz
Support '-' and '@' for homebrew cask name
Some cask name include '-' and '@' so I fix regular expression for cask name validation.
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/resource/homebrew_cask_spec.rb66
1 files changed, 55 insertions, 11 deletions
diff --git a/spec/unit/resource/homebrew_cask_spec.rb b/spec/unit/resource/homebrew_cask_spec.rb
index ed68bc613f..5b6ddac7d2 100644
--- a/spec/unit/resource/homebrew_cask_spec.rb
+++ b/spec/unit/resource/homebrew_cask_spec.rb
@@ -19,22 +19,66 @@ require "spec_helper"
describe Chef::Resource::HomebrewCask do
- let(:resource) { Chef::Resource::HomebrewCask.new("fakey_fakerton") }
+ context 'name with under bar' do
+ let(:resource) { Chef::Resource::HomebrewCask.new("fakey_fakerton") }
- it "has a resource name of :homebrew_cask" do
- expect(resource.resource_name).to eql(:homebrew_cask)
- end
+ it "has a resource name of :homebrew_cask" do
+ expect(resource.resource_name).to eql(:homebrew_cask)
+ end
+
+ it "the cask_name property is the name_property" do
+ expect(resource.cask_name).to eql("fakey_fakerton")
+ end
+
+ it "sets the default action as :install" do
+ expect(resource.action).to eql([:install])
+ end
- it "the cask_name property is the name_property" do
- expect(resource.cask_name).to eql("fakey_fakerton")
+ it "supports :install, :remove actions" do
+ expect { resource.action :install }.not_to raise_error
+ expect { resource.action :remove }.not_to raise_error
+ end
end
- it "sets the default action as :install" do
- expect(resource.action).to eql([:install])
+ context 'name with high fun' do
+ let(:resource) { Chef::Resource::HomebrewCask.new("fakey-fakerton") }
+
+ it "has a resource name of :homebrew_cask" do
+ expect(resource.resource_name).to eql(:homebrew_cask)
+ end
+
+ it "the cask_name property is the name_property" do
+ expect(resource.cask_name).to eql("fakey-fakerton")
+ end
+
+ it "sets the default action as :install" do
+ expect(resource.action).to eql([:install])
+ end
+
+ it "supports :install, :remove actions" do
+ expect { resource.action :install }.not_to raise_error
+ expect { resource.action :remove }.not_to raise_error
+ end
end
- it "supports :install, :remove actions" do
- expect { resource.action :install }.not_to raise_error
- expect { resource.action :remove }.not_to raise_error
+ context 'name with at mark' do
+ let(:resource) { Chef::Resource::HomebrewCask.new("fakey-fakerton@10") }
+
+ it "has a resource name of :homebrew_cask" do
+ expect(resource.resource_name).to eql(:homebrew_cask)
+ end
+
+ it "the cask_name property is the name_property" do
+ expect(resource.cask_name).to eql("fakey-fakerton@10")
+ end
+
+ it "sets the default action as :install" do
+ expect(resource.action).to eql([:install])
+ end
+
+ it "supports :install, :remove actions" do
+ expect { resource.action :install }.not_to raise_error
+ expect { resource.action :remove }.not_to raise_error
+ end
end
end