test/test_valuedate.rb in valuedate-0.0.4 vs test/test_valuedate.rb in valuedate-0.0.5

- old
+ new

@@ -194,10 +194,11 @@ asserts("valid empty array") { v([]) { value.is_a(Array).is { |value| value.empty? } } } asserts("valid array size") { v([1,2]) { value.is { |value| value.size == 2 } } } asserts("invalid array size") { !v([1,2]) { value.not { |value| value.size == 2 } } } end + # TODO refactor! context "errors" do setup do Valuedate.schema {} end @@ -218,15 +219,10 @@ ) end end asserts("fails") { !topic.validate({}) } - asserts_validation_error(:key => :key1, :matcher => :is_a) { topic.validate!({}) } - asserts_validation_error(:key => :key1, :matcher => :is_a) { topic.validate!(:key1 => 23) } - asserts_validation_error(:key => :key1, :matcher => :equals) { topic.validate!(:key1 => "value") } - asserts_validation_error(:key => :key2, :matcher => :is_a) { topic.validate!(:key1 => "key") } - asserts_validation_error(:key => :key2, :matcher => :is_a) { topic.validate!(:key1 => "key", :key2 => {}) } - asserts_validation_error(:key => :key2, :matcher => :is_a) { topic.validate!(:key1 => "key", :key2 => {:key3 => 0.0}) } + asserts_validation_error(:key => :key3, :matcher => :is_a) { topic.validate!(:key1 => "key", :key2 => {:key3 => 0.0}) } asserts("passes") { topic.validate(:key1 => "key", :key2 => {:key3 => 23}) } end end end