summaryrefslogtreecommitdiff
path: root/spec/unit/cookbook
diff options
context:
space:
mode:
authorSerdar Sutay <serdar@opscode.com>2014-10-10 13:35:38 -0700
committerSerdar Sutay <serdar@opscode.com>2014-10-10 13:35:38 -0700
commit6d66ea10c5f1d4188f7759c1a440085682ee6f1f (patch)
tree06a1cd533ccaf55cd97b4758cdaa282ad3deaab3 /spec/unit/cookbook
parentec793c6781a3819dd03f989a7027444452d73fa1 (diff)
parentd36f09a19544ce4329ed8d5d80017d7a28359cd6 (diff)
downloadchef-6d66ea10c5f1d4188f7759c1a440085682ee6f1f.tar.gz
Merge pull request #1914 from gofullstack/supermarket_attributes_metadata
Add supermarket_attributes to Metadata
Diffstat (limited to 'spec/unit/cookbook')
-rw-r--r--spec/unit/cookbook/metadata_spec.rb41
1 files changed, 37 insertions, 4 deletions
diff --git a/spec/unit/cookbook/metadata_spec.rb b/spec/unit/cookbook/metadata_spec.rb
index 86be0d2390..51814320d4 100644
--- a/spec/unit/cookbook/metadata_spec.rb
+++ b/spec/unit/cookbook/metadata_spec.rb
@@ -29,7 +29,8 @@ describe Chef::Cookbook::Metadata do
@fields = [ :name, :description, :long_description, :maintainer,
:maintainer_email, :license, :platforms, :dependencies,
:recommendations, :suggestions, :conflicting, :providing,
- :replacing, :attributes, :groupings, :recipes, :version]
+ :replacing, :attributes, :groupings, :recipes, :version,
+ :source_url, :issues_url ]
end
it "does not depend on object identity for equality" do
@@ -140,6 +141,13 @@ describe Chef::Cookbook::Metadata do
metadata.recipes.should eq(Mash.new)
end
+ it "has an empty source_url string" do
+ metadata.source_url.should eq('')
+ end
+
+ it "has an empty issues_url string" do
+ metadata.issues_url.should eq('')
+ end
end
describe "validation" do
@@ -188,7 +196,9 @@ describe Chef::Cookbook::Metadata do
:license => "Apache v2.0",
:description => "Foobar!",
:long_description => "Much Longer\nSeriously",
- :version => "0.6.0"
+ :version => "0.6.0",
+ :source_url => "http://example.com",
+ :issues_url => "http://example.com/issues"
}
params.sort { |a,b| a.to_s <=> b.to_s }.each do |field, field_value|
describe field do
@@ -333,7 +343,9 @@ describe Chef::Cookbook::Metadata do
"type" => 'string',
"required" => 'recommended',
"recipes" => [ "mysql::server", "mysql::master" ],
- "default" => [ ]
+ "default" => [ ],
+ "source_url" => "http://example.com",
+ "issues_url" => "http://example.com/issues"
}
metadata.attribute("/db/mysql/databases", attrs).should == attrs
end
@@ -356,6 +368,24 @@ describe Chef::Cookbook::Metadata do
}.should raise_error(ArgumentError)
end
+ it "should not accept anything but a string for the source_url" do
+ lambda {
+ metadata.attribute("db/mysql/databases", :source_url => "foo")
+ }.should_not raise_error
+ lambda {
+ metadata.attribute("db/mysql/databases", :source_url => Hash.new)
+ }.should raise_error(ArgumentError)
+ end
+
+ it "should not accept anything but a string for the issues_url" do
+ lambda {
+ metadata.attribute("db/mysql/databases", :issues_url => "foo")
+ }.should_not raise_error
+ lambda {
+ metadata.attribute("db/mysql/databases", :issues_url => Hash.new)
+ }.should raise_error(ArgumentError)
+ end
+
it "should not accept anything but an array of strings for choice" do
lambda {
metadata.attribute("db/mysql/databases", :choice => ['dedicated', 'shared'])
@@ -652,6 +682,8 @@ describe Chef::Cookbook::Metadata do
attributes
recipes
version
+ source_url
+ issues_url
}.each do |t|
it "should include '#{t}'" do
deserialized_metadata[t].should == metadata.send(t.to_sym)
@@ -685,6 +717,8 @@ describe Chef::Cookbook::Metadata do
attributes
recipes
version
+ source_url
+ issues_url
}.each do |t|
it "should match '#{t}'" do
deserialized_metadata.send(t.to_sym).should == metadata.send(t.to_sym)
@@ -735,5 +769,4 @@ describe Chef::Cookbook::Metadata do
end
end
-
end