Skip to content

Commit

Permalink
Use already created objects for tests instead of creating new ones
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosantoniodasilva committed Jul 6, 2010
1 parent eef1122 commit beeabda
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
10 changes: 4 additions & 6 deletions test/error_notification_test.rb
Expand Up @@ -8,11 +8,9 @@ def with_error_notification_for(object, options={}, &block)
end)
end

test 'error notification is not generated when the form has no error' do
valid_user = ValidatingUser.new
valid_user.name = 'Carlos'
assert valid_user.valid?
with_error_notification_for valid_user
test 'error notification is not generated when the object has no error' do
assert @validating_user.valid?
with_error_notification_for @validating_user
assert_no_select 'p.error_notification'
end

Expand All @@ -21,7 +19,7 @@ def with_error_notification_for(object, options={}, &block)
assert_no_select 'p.error_notification'
end

test 'error notification is generated when the form has some error' do
test 'error notification is generated when the object has some error' do
with_error_notification_for @user
assert_select 'p.error_notification', 'Some errors were found, please take a look:'
end
Expand Down
1 change: 0 additions & 1 deletion test/form_builder_test.rb
Expand Up @@ -257,7 +257,6 @@ def with_association_for(object, *args)
end
end


test 'builder input should allow disabling required when ActiveModel::Validations is not included' do
with_form_for @user, :name, :required => false
assert_no_select 'input.required'
Expand Down

0 comments on commit beeabda

Please sign in to comment.