test/test_valuedate.rb in valuedate-0.0.5 vs test/test_valuedate.rb in valuedate-0.0.6
- old
+ new
@@ -194,9 +194,15 @@
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
+ context "matches" do
+ asserts("valid Regexp") { v("test me") { value.matches(%r{^test}) } }
+ asserts("invalid Regexp") { !v("fest me") { value.matches(%r{^test}) } }
+ asserts("invalid Fixnum") { !v(1) { value.matches(%r{^test}) } }
+ end
+
# TODO refactor!
context "errors" do
setup do
Valuedate.schema {}
end