0
@@ -191,6 +191,11 @@ describe "Validations" do
0
+ specify "should not validate acceptance_of with if => false" do
0
+ @c.validates_acceptance_of :value, :allow_nil => false, :if => lambda {|m| false}
0
specify "should validate confirmation_of" do
0
@c.send(:attr_accessor, :value_confirmation)
0
@c.validates_confirmation_of :value
0
@@ -202,6 +207,14 @@ describe "Validations" do
0
+ specify "should not validate confirmation_of :if => false" do
0
+ @c.send(:attr_accessor, :value_confirmation)
0
+ @c.validates_confirmation_of :value, :if => lambda {|m| false}
0
specify "should validate format_of" do
0
@c.validates_format_of :value, :with => /.+_.+/
0
@@ -210,6 +223,12 @@ describe "Validations" do
0
+ specify "should not validate format_of :if => false" do
0
+ @c.validates_format_of :value, :with => /.+_.+/, :if => lambda {|m| false}
0
specify "should raise for validate_format_of without regexp" do
0
proc {@c.validates_format_of :value}.should raise_error(ArgumentError)
0
proc {@c.validates_format_of :value, :with => :blah}.should raise_error(ArgumentError)
0
@@ -244,6 +263,11 @@ describe "Validations" do
0
+ specify "should not validate length_of :if => false" do
0
+ @c.validates_length_of :value, :within => 2..5, :if => Proc.new {|m| m.value != nil}
0
specify "should validate length_of with is" do
0
@c.validates_length_of :value, :is => 3
0
@@ -270,6 +294,12 @@ describe "Validations" do
0
+ specify "should not validate numericality_of :if => false" do
0
+ @c.validates_numericality_of :value, :if => lambda {|m| m.value != 'blah'}
0
specify "should validate numericality_of with only_integer" do
0
@c.validates_numericality_of :value, :only_integer => true
0
@@ -288,6 +318,16 @@ describe "Validations" do
0
+ specify "should not validate presence_of :if => false" do
0
+ @c.validates_presence_of :value, :if => Proc.new {|s| false}
0
+ specify "should validate presence of :if => true" do
0
+ @c.validates_presence_of :value, :if => Proc.new {|s| true}
0
+ @m.should_not be_valid
0
context "Superclass validations" do
Comments
No one has commented yet.