Use already created objects for tests instead of creating new ones
This commit is contained in:
parent
eef11229c1
commit
beeabda97a
|
@ -8,11 +8,9 @@ class ErrorNotificationTest < ActionView::TestCase
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'error notification is not generated when the form has no error' do
|
test 'error notification is not generated when the object has no error' do
|
||||||
valid_user = ValidatingUser.new
|
assert @validating_user.valid?
|
||||||
valid_user.name = 'Carlos'
|
with_error_notification_for @validating_user
|
||||||
assert valid_user.valid?
|
|
||||||
with_error_notification_for valid_user
|
|
||||||
assert_no_select 'p.error_notification'
|
assert_no_select 'p.error_notification'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -21,7 +19,7 @@ class ErrorNotificationTest < ActionView::TestCase
|
||||||
assert_no_select 'p.error_notification'
|
assert_no_select 'p.error_notification'
|
||||||
end
|
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
|
with_error_notification_for @user
|
||||||
assert_select 'p.error_notification', 'Some errors were found, please take a look:'
|
assert_select 'p.error_notification', 'Some errors were found, please take a look:'
|
||||||
end
|
end
|
||||||
|
|
|
@ -257,7 +257,6 @@ class FormBuilderTest < ActionView::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
test 'builder input should allow disabling required when ActiveModel::Validations is not included' do
|
test 'builder input should allow disabling required when ActiveModel::Validations is not included' do
|
||||||
with_form_for @user, :name, :required => false
|
with_form_for @user, :name, :required => false
|
||||||
assert_no_select 'input.required'
|
assert_no_select 'input.required'
|
||||||
|
|
Loading…
Reference in New Issue