summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorJohn Keiser <john@johnkeiser.com>2015-06-30 14:50:58 -0600
committerJohn Keiser <john@johnkeiser.com>2015-07-03 13:10:23 -0600
commit17039741776d3e597776cee859746d8efd586a6d (patch)
tree06c1a4423f22a2da3cb24954dd4c3bdfa3922a24 /spec
parent901f122c5a906b8f64e8ed1919674ffe9d839bf0 (diff)
downloadchef-17039741776d3e597776cee859746d8efd586a6d.tar.gz
Add Property.create and Resource.property_type for type system overriding
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/mixin/params_validate_spec.rb4
-rw-r--r--spec/unit/property/validation_spec.rb2
-rw-r--r--spec/unit/property_spec.rb5
3 files changed, 8 insertions, 3 deletions
diff --git a/spec/unit/mixin/params_validate_spec.rb b/spec/unit/mixin/params_validate_spec.rb
index 2a38972f05..3724bbf583 100644
--- a/spec/unit/mixin/params_validate_spec.rb
+++ b/spec/unit/mixin/params_validate_spec.rb
@@ -333,11 +333,11 @@ describe Chef::Mixin::ParamsValidate do
it "asserts that a value returns false from a predicate method" do
expect do
@vo.validate({:not_blank => "should pass"},
- {:not_blank => {:cannot_be => :nil, :cannot_be => :empty}})
+ {:not_blank => {:cannot_be => [ :nil, :empty ]}})
end.not_to raise_error
expect do
@vo.validate({:not_blank => ""},
- {:not_blank => {:cannot_be => :nil, :cannot_be => :empty}})
+ {:not_blank => {:cannot_be => [ :nil, :empty ]}})
end.to raise_error(Chef::Exceptions::ValidationFailed)
end
diff --git a/spec/unit/property/validation_spec.rb b/spec/unit/property/validation_spec.rb
index 35363b0569..259501d4d8 100644
--- a/spec/unit/property/validation_spec.rb
+++ b/spec/unit/property/validation_spec.rb
@@ -556,7 +556,7 @@ describe "Chef::Resource.property validation" do
end
with_property ':x, name_property: true, required: true' do
- it "if x is not specified, retrieval succeeds" do
+ it "if x is not specified, the name property is returned" do
expect(resource.x).to eq 'blah'
end
it "value 1 is valid" do
diff --git a/spec/unit/property_spec.rb b/spec/unit/property_spec.rb
index 23f6f51d2c..09f7e52329 100644
--- a/spec/unit/property_spec.rb
+++ b/spec/unit/property_spec.rb
@@ -958,6 +958,11 @@ describe "Chef::Resource.property" do
expect(resource.x).to eq 10
end
end
+ with_property ":x, #{name}: true, required: true" do
+ it "defaults x to resource.name" do
+ expect(resource.x).to eq 'blah'
+ end
+ end
end
end
end