From 2a1b232c28c18dfeac71435cf90dc5117d1cf215 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 8 Jul 2010 12:19:12 +0200 Subject: [PATCH] Reorganize tests a bit. --- test/inputs_test.rb | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/test/inputs_test.rb b/test/inputs_test.rb index e0fbbf54d..d03a9b363 100644 --- a/test/inputs_test.rb +++ b/test/inputs_test.rb @@ -27,27 +27,12 @@ def with_input_for(object, attribute_name, type, options={}) 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 @@ def with_input_for(object, attribute_name, type, options={}) 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