From beeabda97a23ca175a378ecd40446a551c85d22d Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Tue, 6 Jul 2010 19:00:44 -0300 Subject: [PATCH] Use already created objects for tests instead of creating new ones --- test/error_notification_test.rb | 10 ++++------ test/form_builder_test.rb | 1 - 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/test/error_notification_test.rb b/test/error_notification_test.rb index dd696372..6ed2101d 100644 --- a/test/error_notification_test.rb +++ b/test/error_notification_test.rb @@ -8,11 +8,9 @@ class ErrorNotificationTest < ActionView::TestCase 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 @@ -21,7 +19,7 @@ class ErrorNotificationTest < ActionView::TestCase 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 diff --git a/test/form_builder_test.rb b/test/form_builder_test.rb index 63359190..936f66b0 100644 --- a/test/form_builder_test.rb +++ b/test/form_builder_test.rb @@ -257,7 +257,6 @@ class FormBuilderTest < ActionView::TestCase 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'