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

Reorganize tests a bit.

This commit is contained in:
José Valim 2010-07-08 12:19:12 +02:00
parent 25cc5b1e01
commit 2a1b232c28

View file

@ -27,27 +27,12 @@ class InputTest < ActionView::TestCase
assert_select 'select.datetime'
end
# TextFieldInput
# StringInput
test 'input should map text field to string attribute' do
with_input_for @user, :name, :string
assert_select 'input[name=\'user[name]\'][id=user_name][value=New in Simple Form!][type=text]'
end
test 'input should generate an integer text field for integer attributes ' do
with_input_for @user, :age, :integer
assert_select 'input[type=number].integer#user_age'
end
test 'input should generate a float text field for float attributes ' do
with_input_for @user, :age, :float
assert_select 'input[type=number].float#user_age'
end
test 'input should generate a decimal text field for decimal attributes ' do
with_input_for @user, :age, :decimal
assert_select 'input[type=number].decimal#user_age'
end
test 'input should use default text size for decimal attributes' do
with_input_for @user, :credit_limit, :decimal
assert_select 'input.decimal[size=50]'
@ -63,6 +48,22 @@ class InputTest < ActionView::TestCase
assert_select 'input.string[size=50]'
end
# NumericInput
test 'input should generate an integer text field for integer attributes ' do
with_input_for @user, :age, :integer
assert_select 'input[type=number].integer#user_age'
end
test 'input should generate a float text field for float attributes ' do
with_input_for @user, :age, :float
assert_select 'input[type=number].float#user_age'
end
test 'input should generate a decimal text field for decimal attributes ' do
with_input_for @user, :age, :decimal
assert_select 'input[type=number].decimal#user_age'
end
# BooleanInput
test 'input should generate a checkbox by default for boolean attributes' do
with_input_for @user, :active, :boolean