test/macros/validates_length_test.rb in whyvalidationssuckin96-1.2.0 vs test/macros/validates_length_test.rb in whyvalidationssuckin96-1.2.1
- old
+ new
@@ -12,9 +12,14 @@
should "have a message accessor with a default message" do
WhyValidationsSuckIn96::ValidatesLength.new(Object.new, :attribute => :text, :is => 3).message
end.equals("does not meet the given length restrictions")
+ should "not blow up with a nil attribute" do
+ validation = WhyValidationsSuckIn96::ValidatesLength.new(OpenStruct.new(:text => nil), :attribute => :text, :is => 3)
+ validation.validates?
+ end.equals(false)
+
context "when specifying the :is option" do
should "not raise if solely :is is given" do
WhyValidationsSuckIn96::ValidatesLength.new(Object.new, :attribute => :text, :is => 3)
end
\ No newline at end of file