summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2015-02-05 12:26:11 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2015-02-05 12:26:11 -0800
commit062227a7139f8109e1ebc9a8de4efe770ff32673 (patch)
treece1cac9e9764ae90843c001c617c6e6accf1999c
parentd6d4fd8721872a0fbd888678e41ca7f5efab994a (diff)
downloadchef-062227a7139f8109e1ebc9a8de4efe770ff32673.tar.gz
specs
-rw-r--r--spec/unit/lwrp_spec.rb12
-rw-r--r--spec/unit/provider/package/yum_spec.rb2
-rw-r--r--spec/unit/provider/package_spec.rb2
-rw-r--r--spec/unit/resource_spec.rb14
4 files changed, 18 insertions, 12 deletions
diff --git a/spec/unit/lwrp_spec.rb b/spec/unit/lwrp_spec.rb
index 64a2176e76..ec39174da6 100644
--- a/spec/unit/lwrp_spec.rb
+++ b/spec/unit/lwrp_spec.rb
@@ -341,8 +341,8 @@ describe "LWRP" do
Chef::Runner.new(@run_context).converge
expect(@run_context.resource_collection[0]).to eql(injector)
- expect(@run_context.resource_collection[1].name).to eql(:prepared_thumbs)
- expect(@run_context.resource_collection[2].name).to eql(:twiddled_thumbs)
+ expect(@run_context.resource_collection[1].name).to eql('prepared_thumbs')
+ expect(@run_context.resource_collection[2].name).to eql('twiddled_thumbs')
expect(@run_context.resource_collection[3]).to eql(dummy)
end
@@ -365,12 +365,12 @@ describe "LWRP" do
Chef::Runner.new(@run_context).converge
expect(@run_context.resource_collection[0]).to eql(injector)
- expect(@run_context.resource_collection[1].name).to eql(:prepared_thumbs)
- expect(@run_context.resource_collection[2].name).to eql(:twiddled_thumbs)
+ expect(@run_context.resource_collection[1].name).to eql('prepared_thumbs')
+ expect(@run_context.resource_collection[2].name).to eql('twiddled_thumbs')
expect(@run_context.resource_collection[3]).to eql(dummy)
expect(@run_context.resource_collection[4]).to eql(injector2)
- expect(@run_context.resource_collection[5].name).to eql(:prepared_eyes)
- expect(@run_context.resource_collection[6].name).to eql(:dried_paint_watched)
+ expect(@run_context.resource_collection[5].name).to eql('prepared_eyes')
+ expect(@run_context.resource_collection[6].name).to eql('dried_paint_watched')
end
it "should properly handle a new_resource reference" do
diff --git a/spec/unit/provider/package/yum_spec.rb b/spec/unit/provider/package/yum_spec.rb
index 8b4c71ee0a..e5e32bc9c0 100644
--- a/spec/unit/provider/package/yum_spec.rb
+++ b/spec/unit/provider/package/yum_spec.rb
@@ -1888,7 +1888,7 @@ describe "Chef::Provider::Package::Yum - Multi" do
describe "when loading the current system state" do
it "should create a current resource with the name of the new_resource" do
@provider.load_current_resource
- expect(@provider.current_resource.name).to eq(['cups', 'vim'])
+ expect(@provider.current_resource.name).to eq('cups, vim')
end
it "should set the current resources package name to the new resources package name" do
diff --git a/spec/unit/provider/package_spec.rb b/spec/unit/provider/package_spec.rb
index 6a0cb695b0..1633d18f9d 100644
--- a/spec/unit/provider/package_spec.rb
+++ b/spec/unit/provider/package_spec.rb
@@ -539,7 +539,7 @@ describe "Chef::Provider::Package - Multi" do
it "should upgrade the package if the current versions are not the candidate version" do
@current_resource.version ['0.9', '6.1']
expect(@provider).to receive(:upgrade_package).with(
- @new_resource.name,
+ @new_resource.package_name,
@provider.candidate_version
).and_return(true)
@provider.run_action(:upgrade)
diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb
index 56c7401c92..8214021f65 100644
--- a/spec/unit/resource_spec.rb
+++ b/spec/unit/resource_spec.rb
@@ -194,12 +194,12 @@ describe Chef::Resource do
expect(@resource.name).to eql("monkey")
end
- it "should not be valid without a name" do
- expect { @resource.name false }.to raise_error(ArgumentError)
+ it "coerces arrays to names" do
+ expect(@resource.name ['a', 'b']).to eql('a, b')
end
- it "should always have a string for name" do
- expect { @resource.name Hash.new }.to raise_error(ArgumentError)
+ it "should coerce objects to a string" do
+ expect(@resource.name Object.new).to be_a(String)
end
end
@@ -258,6 +258,12 @@ describe Chef::Resource do
expected_notification = Chef::Resource::Notification.new({:service => "apache"}, :restart, @resource)
expect(@resource.delayed_notifications).to include(expected_notification)
end
+
+ it "notifies a resource with an array for its name via its prettified string name" do
+ @run_context.resource_collection << Chef::Resource::ZenMaster.new(["coffee", "tea"])
+ @resource.notifies :reload, @run_context.resource_collection.find(:zen_master => "coffee, tea")
+ expect(@resource.delayed_notifications.detect{|e| e.resource.name == "coffee, tea" && e.action == :reload}).not_to be_nil
+ end
end
describe "subscribes" do