Refactor setup association in error test.

This commit is contained in:
Carlos Antonio da Silva 2009-12-11 01:22:11 -02:00
parent 461f309bc7
commit 5579a23736
1 changed files with 3 additions and 3 deletions

View File

@ -2,10 +2,10 @@ require 'test_helper'
class ErrorTest < ActionView::TestCase
def with_error_for(object, attribute, type, options={}, &block)
def with_error_for(object, attribute, type, options={}, setup_association=false, &block)
simple_form_for object do |f|
f.attribute = attribute
f.reflection = Association.new(Company, :company, {}) if options.delete(:setup_association)
f.reflection = Association.new(Company, :company, {}) if setup_association
f.input_type = type
f.options = options
@ -49,7 +49,7 @@ class ErrorTest < ActionView::TestCase
end
test 'error should find errors on attribute and association' do
with_error_for @user, :company_id, :select, :setup_association => true
with_error_for @user, :company_id, :select, {}, true
assert_select 'span.error', 'must be valid and company must be present'
end
end