summaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2018-01-31 18:22:29 +0000
committerThom May <thom@chef.io>2018-02-12 17:36:12 +0000
commitd3031263eb7c5a31e8f20b4b54d33d184345ae45 (patch)
tree00f02c928cb240b9ee1be8b65e2fe19f823dad94 /spec/unit
parenta7d56100275045ad44e57386aad86e463788ee85 (diff)
downloadchef-d3031263eb7c5a31e8f20b4b54d33d184345ae45.tar.gz
properties can have descriptions
Signed-off-by: Thom May <thom@chef.io>
Diffstat (limited to 'spec/unit')
-rw-r--r--spec/unit/mixin/properties_spec.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/spec/unit/mixin/properties_spec.rb b/spec/unit/mixin/properties_spec.rb
index 1af0bc7abd..faf2d98558 100644
--- a/spec/unit/mixin/properties_spec.rb
+++ b/spec/unit/mixin/properties_spec.rb
@@ -11,6 +11,7 @@ module ChefMixinPropertiesSpec
property :a, "a", default: "a"
property :ab, %w{a b}, default: "a"
property :ac, %w{a c}, default: "a"
+ property :d, "d", description: "The d property"
end
context "and a module B with properties b, ab and bc" do
@@ -30,11 +31,16 @@ module ChefMixinPropertiesSpec
end
it "A.properties has a, ab, and ac with types 'a', ['a', 'b'], and ['b', 'c']" do
- expect(A.properties.keys).to eq [ :a, :ab, :ac ]
+ expect(A.properties.keys).to eq [ :a, :ab, :ac, :d ]
expect(A.properties[:a].validation_options[:is]).to eq "a"
expect(A.properties[:ab].validation_options[:is]).to eq %w{a b}
expect(A.properties[:ac].validation_options[:is]).to eq %w{a c}
end
+
+ it "A.properties can get the description of `d`" do
+ expect(A.properties[:d].description).to eq "The d property"
+ end
+
it "B.properties has b, ab, and bc with types 'b', nil and ['b', 'c']" do
expect(B.properties.keys).to eq [ :b, :ab, :bc ]
expect(B.properties[:b].validation_options[:is]).to eq "b"
@@ -42,7 +48,7 @@ module ChefMixinPropertiesSpec
expect(B.properties[:bc].validation_options[:is]).to eq %w{b c}
end
it "C.properties has a, b, c, ac and bc with merged types" do
- expect(C.properties.keys).to eq [ :a, :ab, :ac, :b, :bc, :c ]
+ expect(C.properties.keys).to eq [ :a, :ab, :ac, :d, :b, :bc, :c ]
expect(C.properties[:a].validation_options[:is]).to eq "a"
expect(C.properties[:b].validation_options[:is]).to eq "b"
expect(C.properties[:c].validation_options[:is]).to eq "c"