diff options
Diffstat (limited to 'spec/unit/property/validation_spec.rb')
-rw-r--r-- | spec/unit/property/validation_spec.rb | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/spec/unit/property/validation_spec.rb b/spec/unit/property/validation_spec.rb index 5a40cce145..0b2a8e0bc9 100644 --- a/spec/unit/property/validation_spec.rb +++ b/spec/unit/property/validation_spec.rb @@ -8,12 +8,15 @@ describe "Chef::Resource.property validation" do def self.next_resource_name "chef_resource_property_spec_#{@i += 1}" end + def self.reset_index @current_index = 0 end + def self.current_index @current_index end + def self.next_index @current_index += 1 end @@ -38,6 +41,7 @@ describe "Chef::Resource.property validation" do def blah Namer.next_index end + def self.blah "class#{Namer.next_index}" end @@ -55,9 +59,9 @@ describe "Chef::Resource.property validation" do end def self.with_property(*properties, &block) - tags_index = properties.find_index { |p| !p.is_a?(String)} + tags_index = properties.find_index { |p| !p.is_a?(String) } if tags_index - properties, tags = properties[0..tags_index-1], properties[tags_index..-1] + properties, tags = properties[0..tags_index - 1], properties[tags_index..-1] else tags = [] end @@ -516,32 +520,32 @@ describe "Chef::Resource.property validation" do context "cannot_be" do validation_test "cannot_be: :empty", - [ 1, [1,2], { a: 10 } ], + [ 1, [1, 2], { a: 10 } ], [ [] ], :nil_is_valid validation_test 'cannot_be: "empty"', - [ 1, [1,2], { a: 10 } ], + [ 1, [1, 2], { a: 10 } ], [ [] ], :nil_is_valid validation_test "cannot_be: [ :empty, :nil ]", - [ 1, [1,2], { a: 10 } ], + [ 1, [1, 2], { a: 10 } ], [ [] ], :nil_is_valid validation_test 'cannot_be: [ "empty", "nil" ]', - [ 1, [1,2], { a: 10 } ], + [ 1, [1, 2], { a: 10 } ], [ [] ], :nil_is_valid validation_test "cannot_be: [ :nil, :empty ]", - [ 1, [1,2], { a: 10 } ], + [ 1, [1, 2], { a: 10 } ], [ [] ], :nil_is_valid validation_test "cannot_be: [ :empty, :nil, :blahblah ]", - [ 1, [1,2], { a: 10 } ], + [ 1, [1, 2], { a: 10 } ], [ [] ], :nil_is_valid |