1
0
Fork 0
mirror of https://github.com/heartcombo/simple_form.git synced 2022-11-09 12:19:26 -05:00

Add failing test for nested has_many i18n lookup.

This commit is contained in:
Ryan Wallace 2011-05-03 12:33:48 -07:00 committed by Carlos Antonio da Silva
parent 398f3146a3
commit 83f47c5886
2 changed files with 22 additions and 0 deletions

View file

@ -132,6 +132,25 @@ class LabelTest < ActionView::TestCase
assert_select 'label[for=user_company_attributes_name]', /Nome da empresa/
end
end
test 'label should do correct i18n lookup for nested has_many models with no nested translation' do
@user.tags = [Tag.new(1, 'Empresa')]
store_translations(:en, :simple_form => { :labels => {
:user => { :name => 'Usuario' },
:tag => { :name => 'Nome da empresa' }
} } ) do
with_concat_form_for @user do |f|
concat f.input :name
concat(f.simple_fields_for(:tags) do |tags_form|
concat(tags_form.input :name)
end)
end
assert_select 'label[for=user_name]', /Usuario/
assert_select 'label[for=user_tags_attributes_0_name]', /Nome da empresa/
end
end
test 'label should have css class from type' do
with_label_for @user, :name, :string

View file

@ -61,6 +61,9 @@ class User
def company_attributes=(*)
end
def tags_attributes=(*)
end
def column_for_attribute(attribute)
column_type, limit = case attribute.to_sym
when :name, :status, :password then [:string, 100]