Skip to content

Commit

Permalink
Better naming convention for the test conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
bcardarella committed Oct 28, 2011
1 parent fb1fdac commit cf912c2
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions test/action_view/cases/test_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -360,20 +360,20 @@ def test_conditional_validators_should_be_filtered
:cost => {
:presence => {
:message => "can't be blank",
:unless => :cannot_validate?
:unless => :do_not_validate?
}
},
:title => {
:presence => {
:message => "can't be blank",
:if => :can_validate?
:if => :do_validate?
}
}
}

@post.title = nil
@post.stubs(:cannot_validate?).returns(false)
@post.stubs(:can_validate?).returns(true)
@post.stubs(:do_not_validate?).returns(false)
@post.stubs(:do_validate?).returns(true)
@post.stubs(:client_side_validation_hash).returns(hash)
form_for(@post, :validate => true) do |f|
concat f.text_field(:cost)
Expand All @@ -393,20 +393,20 @@ def test_conditional_validator_filters_being_forced
:cost => {
:presence => {
:message => "can't be blank",
:unless => :cannot_validate?
:unless => :do_not_validate?
}
},
:title => {
:presence => {
:message => "can't be blank",
:if => :can_validate?
:if => :do_validate?
}
}
}

@post.title = nil
@post.stubs(:cannot_validate?).returns(false)
@post.stubs(:can_validate?).returns(true)
@post.stubs(:do_not_validate?).returns(false)
@post.stubs(:do_validate?).returns(true)
@post.stubs(:client_side_validation_hash).returns(hash)
form_for(@post, :validate => true) do |f|
concat f.text_field(:cost, :validate => true)
Expand All @@ -429,20 +429,20 @@ def test_conditional_validator_filters_being_forced_and_not_meeting_condition
:cost => {
:presence => {
:message => "can't be blank",
:unless => :cannot_validate?
:unless => :do_not_validate?
}
},
:title => {
:presence => {
:message => "can't be blank",
:if => :can_validate?
:if => :do_validate?
}
}
}

@post.title = nil
@post.stubs(:cannot_validate?).returns(true)
@post.stubs(:can_validate?).returns(false)
@post.stubs(:do_not_validate?).returns(true)
@post.stubs(:do_validate?).returns(false)
@post.stubs(:client_side_validation_hash).returns(hash)
form_for(@post, :validate => true) do |f|
concat f.text_field(:cost, :validate => true)
Expand All @@ -462,20 +462,20 @@ def test_conditional_validator_filters_being_forced_individually
:cost => {
:presence => {
:message => "can't be blank",
:unless => :cannot_validate?
:unless => :do_not_validate?
}
},
:title => {
:presence => {
:message => "can't be blank",
:if => :can_validate?
:if => :do_validate?
}
}
}

@post.title = nil
@post.stubs(:cannot_validate?).returns(false)
@post.stubs(:can_validate?).returns(true)
@post.stubs(:do_not_validate?).returns(false)
@post.stubs(:do_validate?).returns(true)
@post.stubs(:client_side_validation_hash).returns(hash)
form_for(@post, :validate => true) do |f|
concat f.text_field(:cost, :validate => { :presence => true })
Expand All @@ -498,20 +498,20 @@ def test_conditional_validator_filters_being_forced_and_not_meeting_condition_in
:cost => {
:presence => {
:message => "can't be blank",
:unless => :cannot_validate?
:unless => :do_not_validate?
}
},
:title => {
:presence => {
:message => "can't be blank",
:if => :can_validate?
:if => :do_validate?
}
}
}

@post.title = nil
@post.stubs(:cannot_validate?).returns(true)
@post.stubs(:can_validate?).returns(false)
@post.stubs(:do_not_validate?).returns(true)
@post.stubs(:do_validate?).returns(false)
@post.stubs(:client_side_validation_hash).returns(hash)
form_for(@post, :validate => true) do |f|
concat f.text_field(:cost, :validate => { :presence => true })
Expand All @@ -531,20 +531,20 @@ def test_conditional_validator_filters_being_forced_with_procs
:cost => {
:presence => {
:message => "can't be blank",
:unless => Proc.new { |post| post.cannot_validate? }
:unless => Proc.new { |post| post.do_not_validate? }
}
},
:title => {
:presence => {
:message => "can't be blank",
:if => Proc.new { |post| post.can_validate? }
:if => Proc.new { |post| post.do_validate? }
}
}
}

@post.title = nil
@post.stubs(:cannot_validate?).returns(false)
@post.stubs(:can_validate?).returns(true)
@post.stubs(:do_not_validate?).returns(false)
@post.stubs(:do_validate?).returns(true)
@post.stubs(:client_side_validation_hash).returns(hash)
form_for(@post, :validate => true) do |f|
concat f.text_field(:cost, :validate => true)
Expand Down

0 comments on commit cf912c2

Please sign in to comment.