simple_form 3.1.0.rc1 → 3.1.0.rc2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of simple_form might be problematic. Click here for more details.

Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -1
  3. data/README.md +37 -6
  4. data/lib/generators/simple_form/templates/config/initializers/simple_form.rb +6 -2
  5. data/lib/generators/simple_form/templates/config/initializers/simple_form_bootstrap.rb +37 -14
  6. data/lib/simple_form.rb +8 -0
  7. data/lib/simple_form/components/labels.rb +1 -1
  8. data/lib/simple_form/form_builder.rb +29 -15
  9. data/lib/simple_form/inputs/boolean_input.rb +7 -4
  10. data/lib/simple_form/tags.rb +1 -0
  11. data/lib/simple_form/version.rb +1 -1
  12. data/lib/simple_form/wrappers/builder.rb +2 -2
  13. data/lib/simple_form/wrappers/many.rb +1 -0
  14. data/test/action_view_extensions/builder_test.rb +3 -3
  15. data/test/action_view_extensions/form_helper_test.rb +13 -13
  16. data/test/components/label_test.rb +35 -35
  17. data/test/form_builder/association_test.rb +4 -4
  18. data/test/form_builder/button_test.rb +5 -5
  19. data/test/form_builder/error_test.rb +18 -18
  20. data/test/form_builder/general_test.rb +65 -60
  21. data/test/form_builder/hint_test.rb +15 -15
  22. data/test/form_builder/input_field_test.rb +16 -16
  23. data/test/form_builder/label_test.rb +22 -13
  24. data/test/form_builder/wrapper_test.rb +54 -20
  25. data/test/inputs/boolean_input_test.rb +8 -8
  26. data/test/inputs/collection_check_boxes_input_test.rb +24 -7
  27. data/test/inputs/collection_radio_buttons_input_test.rb +40 -23
  28. data/test/inputs/collection_select_input_test.rb +45 -45
  29. data/test/inputs/datetime_input_test.rb +23 -23
  30. data/test/inputs/disabled_test.rb +15 -15
  31. data/test/inputs/discovery_test.rb +44 -5
  32. data/test/inputs/file_input_test.rb +2 -2
  33. data/test/inputs/general_test.rb +20 -20
  34. data/test/inputs/grouped_collection_select_input_test.rb +2 -2
  35. data/test/inputs/hidden_input_test.rb +4 -4
  36. data/test/inputs/numeric_input_test.rb +24 -24
  37. data/test/inputs/priority_input_test.rb +7 -7
  38. data/test/inputs/readonly_test.rb +19 -19
  39. data/test/inputs/required_test.rb +13 -13
  40. data/test/inputs/string_input_test.rb +23 -23
  41. data/test/inputs/text_input_test.rb +4 -4
  42. data/test/support/discovery_inputs.rb +20 -0
  43. data/test/support/misc_helpers.rb +22 -0
  44. data/test/support/models.rb +2 -1
  45. metadata +2 -2
@@ -6,30 +6,30 @@ class CollectionCheckBoxesInputTest < ActionView::TestCase
6
6
  SimpleForm::Inputs::CollectionCheckBoxesInput.reset_i18n_cache :boolean_collection
7
7
  end
8
8
 
9
- test 'input check boxes should not include for attribute by default' do
9
+ test 'input check boxes does not include for attribute by default' do
10
10
  with_input_for @user, :gender, :check_boxes, collection: [:male, :female]
11
11
  assert_select 'label'
12
12
  assert_no_select 'label[for=user_gender]'
13
13
  end
14
14
 
15
- test 'input check boxes should include for attribute when giving as html option' do
15
+ test 'input check boxes includes for attribute when giving as html option' do
16
16
  with_input_for @user, :gender, :check_boxes, collection: [:male, :female], label_html: { for: 'gender' }
17
17
  assert_select 'label[for=gender]'
18
18
  end
19
19
 
20
- test 'collection input with check_boxes type should not generate required html attribute' do
20
+ test 'collection input with check_boxes type does not generate required html attribute' do
21
21
  with_input_for @user, :name, :check_boxes, collection: ['Jose', 'Carlos']
22
22
  assert_select 'input.required'
23
23
  assert_no_select 'input[required]'
24
24
  end
25
25
 
26
- test 'collection input with check_boxes type should not generate aria-required html attribute' do
26
+ test 'collection input with check_boxes type does not generate aria-required html attribute' do
27
27
  with_input_for @user, :name, :check_boxes, collection: ['Jose', 'Carlos']
28
28
  assert_select 'input.required'
29
29
  assert_no_select 'input[aria-required]'
30
30
  end
31
31
 
32
- test 'input should do automatic collection translation for check_box types using defaults key' do
32
+ test 'input does automatic collection translation for check_box types using defaults key' do
33
33
  store_translations(:en, simple_form: { options: { defaults: {
34
34
  gender: { male: 'Male', female: 'Female'}
35
35
  } } } ) do
@@ -41,7 +41,7 @@ class CollectionCheckBoxesInputTest < ActionView::TestCase
41
41
  end
42
42
  end
43
43
 
44
- test 'input should do automatic collection translation for check_box types using specific object key' do
44
+ test 'input does automatic collection translation for check_box types using specific object key' do
45
45
  store_translations(:en, simple_form: { options: { user: {
46
46
  gender: { male: 'Male', female: 'Female'}
47
47
  } } } ) do
@@ -53,7 +53,7 @@ class CollectionCheckBoxesInputTest < ActionView::TestCase
53
53
  end
54
54
  end
55
55
 
56
- test 'input that uses automatic collection translation for check_boxes should properly set checked values' do
56
+ test 'input that uses automatic collection translation for check_boxes properly sets checked values' do
57
57
  store_translations(:en, simple_form: { options: { defaults: {
58
58
  gender: { male: 'Male', female: 'Female'}
59
59
  } } } ) do
@@ -245,6 +245,23 @@ class CollectionCheckBoxesInputTest < ActionView::TestCase
245
245
  end
246
246
  end
247
247
 
248
+ test 'input check boxes with nested style renders item labels with specified class' do
249
+ swap SimpleForm, boolean_style: :nested do
250
+ with_input_for @user, :active, :check_boxes, item_label_class: "test"
251
+
252
+ assert_select 'span.checkbox > label.test > input'
253
+ end
254
+ end
255
+
256
+ test 'input check boxes with nested style and falsey input wrapper renders item labels with specified class' do
257
+ swap SimpleForm, boolean_style: :nested, item_wrapper_tag: false do
258
+ with_input_for @user, :active, :check_boxes, item_label_class: "checkbox-inline"
259
+
260
+ assert_select 'label.checkbox-inline > input'
261
+ assert_no_select 'span.checkbox'
262
+ end
263
+ end
264
+
248
265
  test 'input check boxes wrapper class are not included when set to falsey' do
249
266
  swap SimpleForm, include_default_input_wrapper_class: false, boolean_style: :nested do
250
267
  with_input_for @user, :gender, :check_boxes, collection: [:male, :female]
@@ -6,19 +6,19 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
6
6
  SimpleForm::Inputs::CollectionRadioButtonsInput.reset_i18n_cache :boolean_collection
7
7
  end
8
8
 
9
- test 'input should generate boolean radio buttons by default for radio types' do
9
+ test 'input generates boolean radio buttons by default for radio types' do
10
10
  with_input_for @user, :active, :radio_buttons
11
11
  assert_select 'input[type=radio][value=true].radio_buttons#user_active_true'
12
12
  assert_select 'input[type=radio][value=false].radio_buttons#user_active_false'
13
13
  end
14
14
 
15
- test 'input as radio should generate internal labels by default' do
15
+ test 'input as radio generates internal labels by default' do
16
16
  with_input_for @user, :active, :radio_buttons
17
17
  assert_select 'label[for=user_active_true]', 'Yes'
18
18
  assert_select 'label[for=user_active_false]', 'No'
19
19
  end
20
20
 
21
- test 'input as radio should generate internal labels with accurate `for` values with nested boolean style' do
21
+ test 'input as radio generates internal labels with accurate `for` values with nested boolean style' do
22
22
  swap SimpleForm, boolean_style: :nested do
23
23
  with_input_for @user, :active, :radio_buttons
24
24
  assert_select 'label[for=user_active_true]', 'Yes'
@@ -26,7 +26,7 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
26
26
  end
27
27
  end
28
28
 
29
- test 'nested label should not duplicate input id' do
29
+ test 'nested label does not duplicate input id' do
30
30
  swap SimpleForm, boolean_style: :nested do
31
31
  with_input_for @user, :active, :radio_buttons, id: 'nested_id'
32
32
  assert_select 'input#user_active_true'
@@ -34,7 +34,7 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
34
34
  end
35
35
  end
36
36
 
37
- test 'input as radio should use i18n to translate internal labels' do
37
+ test 'input as radio uses i18n to translate internal labels' do
38
38
  store_translations(:en, simple_form: { yes: 'Sim', no: 'Não' }) do
39
39
  with_input_for @user, :active, :radio_buttons
40
40
  assert_select 'label[for=user_active_true]', 'Sim'
@@ -42,25 +42,25 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
42
42
  end
43
43
  end
44
44
 
45
- test 'input radio should not include for attribute by default' do
45
+ test 'input radio does not include for attribute by default' do
46
46
  with_input_for @user, :gender, :radio_buttons, collection: [:male, :female]
47
47
  assert_select 'label'
48
48
  assert_no_select 'label[for=user_gender]'
49
49
  end
50
50
 
51
- test 'input radio should include for attribute when giving as html option' do
51
+ test 'input radio includes for attribute when giving as html option' do
52
52
  with_input_for @user, :gender, :radio_buttons, collection: [:male, :female], label_html: { for: 'gender' }
53
53
  assert_select 'label[for=gender]'
54
54
  end
55
55
 
56
- test 'input should mark the checked value when using boolean and radios' do
56
+ test 'input marks the checked value when using boolean and radios' do
57
57
  @user.active = false
58
58
  with_input_for @user, :active, :radio_buttons
59
59
  assert_no_select 'input[type=radio][value=true][checked]'
60
60
  assert_select 'input[type=radio][value=false][checked]'
61
61
  end
62
62
 
63
- test 'input should allow overriding collection for radio types' do
63
+ test 'input allows overriding collection for radio types' do
64
64
  with_input_for @user, :name, :radio_buttons, collection: ['Jose', 'Carlos']
65
65
  assert_select 'input[type=radio][value=Jose]'
66
66
  assert_select 'input[type=radio][value=Carlos]'
@@ -68,7 +68,7 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
68
68
  assert_select 'label.collection_radio_buttons[for=user_name_carlos]', 'Carlos'
69
69
  end
70
70
 
71
- test 'input should do automatic collection translation for radio types using defaults key' do
71
+ test 'input does automatic collection translation for radio types using defaults key' do
72
72
  store_translations(:en, simple_form: { options: { defaults: {
73
73
  gender: { male: 'Male', female: 'Female'}
74
74
  } } } ) do
@@ -80,7 +80,7 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
80
80
  end
81
81
  end
82
82
 
83
- test 'input should do automatic collection translation for radio types using specific object key' do
83
+ test 'input does automatic collection translation for radio types using specific object key' do
84
84
  store_translations(:en, simple_form: { options: { user: {
85
85
  gender: { male: 'Male', female: 'Female'}
86
86
  } } } ) do
@@ -92,7 +92,7 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
92
92
  end
93
93
  end
94
94
 
95
- test 'input should do automatic collection translation and preserve html markup' do
95
+ test 'input does automatic collection translation and preserve html markup' do
96
96
  swap SimpleForm, boolean_style: :nested do
97
97
  store_translations(:en, simple_form: { options: { user: {
98
98
  gender: { male_html: '<strong>Male</strong>', female_html: '<strong>Female</strong>' }
@@ -106,7 +106,7 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
106
106
  end
107
107
  end
108
108
 
109
- test 'input should do automatic collection translation with keys prefixed with _html and a string value' do
109
+ test 'input does automatic collection translation with keys prefixed with _html and a string value' do
110
110
  swap SimpleForm, boolean_style: :nested do
111
111
  store_translations(:en, simple_form: { options: { user: {
112
112
  gender: { male_html: 'Male', female_html: 'Female' }
@@ -120,18 +120,18 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
120
120
  end
121
121
  end
122
122
 
123
- test 'input should mark the current radio value by default' do
123
+ test 'input marks the current radio value by default' do
124
124
  @user.name = "Carlos"
125
125
  with_input_for @user, :name, :radio_buttons, collection: ['Jose', 'Carlos']
126
126
  assert_select 'input[type=radio][value=Carlos][checked=checked]'
127
127
  end
128
128
 
129
- test 'input should accept html options as the last element of collection' do
129
+ test 'input accepts html options as the last element of collection' do
130
130
  with_input_for @user, :name, :radio_buttons, collection: [['Jose', 'jose', class: 'foo']]
131
131
  assert_select 'input.foo[type=radio][value=jose]'
132
132
  end
133
133
 
134
- test 'input should allow using a collection with text/value arrays' do
134
+ test 'input allows using a collection with text/value arrays' do
135
135
  with_input_for @user, :name, :radio_buttons, collection: [['Jose', 'jose'], ['Carlos', 'carlos']]
136
136
  assert_select 'input[type=radio][value=jose]'
137
137
  assert_select 'input[type=radio][value=carlos]'
@@ -139,13 +139,13 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
139
139
  assert_select 'label.collection_radio_buttons', 'Carlos'
140
140
  end
141
141
 
142
- test 'input should allow using a collection with a Proc' do
142
+ test 'input allows using a collection with a Proc' do
143
143
  with_input_for @user, :name, :radio_buttons, collection: Proc.new { ['Jose', 'Carlos' ] }
144
144
  assert_select 'label.collection_radio_buttons', 'Jose'
145
145
  assert_select 'label.collection_radio_buttons', 'Carlos'
146
146
  end
147
147
 
148
- test 'input should allow overriding only label method for collections' do
148
+ test 'input allows overriding only label method for collections' do
149
149
  with_input_for @user, :name, :radio_buttons,
150
150
  collection: ['Jose', 'Carlos'],
151
151
  label_method: :upcase
@@ -153,7 +153,7 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
153
153
  assert_select 'label.collection_radio_buttons', 'CARLOS'
154
154
  end
155
155
 
156
- test 'input should allow overriding only value method for collections' do
156
+ test 'input allows overriding only value method for collections' do
157
157
  with_input_for @user, :name, :radio_buttons,
158
158
  collection: ['Jose', 'Carlos'],
159
159
  value_method: :upcase
@@ -161,7 +161,7 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
161
161
  assert_select 'input[type=radio][value=CARLOS]'
162
162
  end
163
163
 
164
- test 'input should allow overriding label and value method for collections' do
164
+ test 'input allows overriding label and value method for collections' do
165
165
  with_input_for @user, :name, :radio_buttons,
166
166
  collection: ['Jose', 'Carlos'],
167
167
  label_method: :upcase,
@@ -172,7 +172,7 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
172
172
  assert_select 'label.collection_radio_buttons', 'CARLOS'
173
173
  end
174
174
 
175
- test 'input should allow overriding label and value method using a lambda for collections' do
175
+ test 'input allows overriding label and value method using a lambda for collections' do
176
176
  with_input_for @user, :name, :radio_buttons,
177
177
  collection: ['Jose', 'Carlos'],
178
178
  label_method: lambda { |i| i.upcase },
@@ -183,13 +183,13 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
183
183
  assert_select 'label.collection_radio_buttons', 'CARLOS'
184
184
  end
185
185
 
186
- test 'collection input with radio type should generate required html attribute' do
186
+ test 'collection input with radio type generates required html attribute' do
187
187
  with_input_for @user, :name, :radio_buttons, collection: ['Jose', 'Carlos']
188
188
  assert_select 'input[type=radio].required'
189
189
  assert_select 'input[type=radio][required]'
190
190
  end
191
191
 
192
- test 'collection input with radio type should generate aria-required html attribute' do
192
+ test 'collection input with radio type generates aria-required html attribute' do
193
193
  with_input_for @user, :name, :radio_buttons, collection: ['Jose', 'Carlos']
194
194
  assert_select 'input[type=radio].required'
195
195
  assert_select 'input[type=radio][aria-required=true]'
@@ -368,6 +368,23 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
368
368
  end
369
369
  end
370
370
 
371
+ test 'input radio with nested style renders item labels with specified class' do
372
+ swap SimpleForm, boolean_style: :nested do
373
+ with_input_for @user, :active, :radio_buttons, item_label_class: "test"
374
+
375
+ assert_select 'span.radio > label.test > input'
376
+ end
377
+ end
378
+
379
+ test 'input radio with nested style and falsey input wrapper renders item labels with specified class' do
380
+ swap SimpleForm, boolean_style: :nested, item_wrapper_tag: false do
381
+ with_input_for @user, :active, :radio_buttons, item_label_class: "radio-inline"
382
+
383
+ assert_select 'label.radio-inline > input'
384
+ assert_no_select 'span.radio'
385
+ end
386
+ end
387
+
371
388
  test 'input radio wrapper class are not included when set to falsey' do
372
389
  swap SimpleForm, include_default_input_wrapper_class: false, boolean_style: :nested do
373
390
  with_input_for @user, :gender, :radio_buttons, collection: [:male, :female]
@@ -6,14 +6,14 @@ class CollectionSelectInputTest < ActionView::TestCase
6
6
  SimpleForm::Inputs::CollectionSelectInput.reset_i18n_cache :boolean_collection
7
7
  end
8
8
 
9
- test 'input should generate a boolean select with options by default for select types' do
9
+ test 'input generates a boolean select with options by default for select types' do
10
10
  with_input_for @user, :active, :select
11
11
  assert_select 'select.select#user_active'
12
12
  assert_select 'select option[value=true]', 'Yes'
13
13
  assert_select 'select option[value=false]', 'No'
14
14
  end
15
15
 
16
- test 'input as select should use i18n to translate select boolean options' do
16
+ test 'input as select uses i18n to translate select boolean options' do
17
17
  store_translations(:en, simple_form: { yes: 'Sim', no: 'Não' }) do
18
18
  with_input_for @user, :active, :select
19
19
  assert_select 'select option[value=true]', 'Sim'
@@ -21,14 +21,14 @@ class CollectionSelectInputTest < ActionView::TestCase
21
21
  end
22
22
  end
23
23
 
24
- test 'input should allow overriding collection for select types' do
24
+ test 'input allows overriding collection for select types' do
25
25
  with_input_for @user, :name, :select, collection: ['Jose', 'Carlos']
26
26
  assert_select 'select.select#user_name'
27
27
  assert_select 'select option', 'Jose'
28
28
  assert_select 'select option', 'Carlos'
29
29
  end
30
30
 
31
- test 'input should do automatic collection translation for select types using defaults key' do
31
+ test 'input does automatic collection translation for select types using defaults key' do
32
32
  store_translations(:en, simple_form: { options: { defaults: {
33
33
  gender: { male: 'Male', female: 'Female'}
34
34
  } } }) do
@@ -39,7 +39,7 @@ class CollectionSelectInputTest < ActionView::TestCase
39
39
  end
40
40
  end
41
41
 
42
- test 'input should do automatic collection translation for select types using specific object key' do
42
+ test 'input does automatic collection translation for select types using specific object key' do
43
43
  store_translations(:en, simple_form: { options: { user: {
44
44
  gender: { male: 'Male', female: 'Female'}
45
45
  } } }) do
@@ -50,38 +50,38 @@ class CollectionSelectInputTest < ActionView::TestCase
50
50
  end
51
51
  end
52
52
 
53
- test 'input should mark the selected value by default' do
53
+ test 'input marks the selected value by default' do
54
54
  @user.name = "Carlos"
55
55
  with_input_for @user, :name, :select, collection: ['Jose', 'Carlos']
56
56
  assert_select 'select option[selected=selected]', 'Carlos'
57
57
  end
58
58
 
59
- test 'input should accept html options as the last element of collection' do
59
+ test 'input accepts html options as the last element of collection' do
60
60
  with_input_for @user, :name, :select, collection: [['Jose', class: 'foo']]
61
61
  assert_select 'select.select#user_name'
62
62
  assert_select 'select option.foo', 'Jose'
63
63
  end
64
64
 
65
- test 'input should mark the selected value also when using integers' do
65
+ test 'input marks the selected value also when using integers' do
66
66
  @user.age = 18
67
67
  with_input_for @user, :age, :select, collection: 18..60
68
68
  assert_select 'select option[selected=selected]', '18'
69
69
  end
70
70
 
71
- test 'input should mark the selected value when using booleans and select' do
71
+ test 'input marks the selected value when using booleans and select' do
72
72
  @user.active = false
73
73
  with_input_for @user, :active, :select
74
74
  assert_no_select 'select option[selected][value=true]', 'Yes'
75
75
  assert_select 'select option[selected][value=false]', 'No'
76
76
  end
77
77
 
78
- test 'input should set the correct value when using a collection that includes floats' do
78
+ test 'input sets the correct value when using a collection that includes floats' do
79
79
  with_input_for @user, :age, :select, collection: [2.0, 2.5, 3.0, 3.5, 4.0, 4.5]
80
80
  assert_select 'select option[value="2.0"]'
81
81
  assert_select 'select option[value="2.5"]'
82
82
  end
83
83
 
84
- test 'input should set the correct values when using a collection that uses mixed values' do
84
+ test 'input sets the correct values when using a collection that uses mixed values' do
85
85
  with_input_for @user, :age, :select, collection: ["Hello Kitty", 2, 4.5, :johnny, nil, true, false]
86
86
  assert_select 'select option[value="Hello Kitty"]'
87
87
  assert_select 'select option[value="2"]'
@@ -92,17 +92,17 @@ class CollectionSelectInputTest < ActionView::TestCase
92
92
  assert_select 'select option[value="false"]'
93
93
  end
94
94
 
95
- test 'input should include a blank option even if :include_blank is set to false if the collection includes a nil value' do
95
+ test 'input includes a blank option even if :include_blank is set to false if the collection includes a nil value' do
96
96
  with_input_for @user, :age, :select, collection: [nil], include_blank: false
97
97
  assert_select 'select option[value=""]'
98
98
  end
99
99
 
100
- test 'input should automatically set include blank' do
100
+ test 'input automatically sets include blank' do
101
101
  with_input_for @user, :age, :select, collection: 18..30
102
102
  assert_select 'select option[value=]', ''
103
103
  end
104
104
 
105
- test 'input should translate include blank when set to :translate' do
105
+ test 'input translates include blank when set to :translate' do
106
106
  store_translations(:en, simple_form: { include_blanks: { user: {
107
107
  age: 'Rather not say'
108
108
  } } }) do
@@ -111,7 +111,7 @@ class CollectionSelectInputTest < ActionView::TestCase
111
111
  end
112
112
  end
113
113
 
114
- test 'input should translate include blank with a default' do
114
+ test 'input translates include blank with a default' do
115
115
  store_translations(:en, simple_form: { include_blanks: { defaults: {
116
116
  age: 'Rather not say',
117
117
  } } }) do
@@ -120,7 +120,7 @@ class CollectionSelectInputTest < ActionView::TestCase
120
120
  end
121
121
  end
122
122
 
123
- test 'input should not translate include blank when set to a string' do
123
+ test 'input does not translate include blank when set to a string' do
124
124
  store_translations(:en, simple_form: { include_blanks: { user: {
125
125
  age: 'Rather not say'
126
126
  } } }) do
@@ -129,7 +129,7 @@ class CollectionSelectInputTest < ActionView::TestCase
129
129
  end
130
130
  end
131
131
 
132
- test 'input should not translate include blank when automatically set' do
132
+ test 'input does not translate include blank when automatically set' do
133
133
  store_translations(:en, simple_form: { include_blanks: { user: {
134
134
  age: 'Rather not say'
135
135
  } } }) do
@@ -138,7 +138,7 @@ class CollectionSelectInputTest < ActionView::TestCase
138
138
  end
139
139
  end
140
140
 
141
- test 'input should not translate include blank when set to true' do
141
+ test 'input does not translate include blank when set to true' do
142
142
  store_translations(:en, simple_form: { include_blanks: { user: {
143
143
  age: 'Rather not say'
144
144
  } } }) do
@@ -147,7 +147,7 @@ class CollectionSelectInputTest < ActionView::TestCase
147
147
  end
148
148
  end
149
149
 
150
- test 'input should not translate include blank when set to false' do
150
+ test 'input does not translate include blank when set to false' do
151
151
  store_translations(:en, simple_form: { include_blanks: { user: {
152
152
  age: 'Rather not say'
153
153
  } } }) do
@@ -156,22 +156,22 @@ class CollectionSelectInputTest < ActionView::TestCase
156
156
  end
157
157
  end
158
158
 
159
- test 'input should not set include blank if otherwise is told' do
159
+ test 'input does not set include blank if otherwise is told' do
160
160
  with_input_for @user, :age, :select, collection: 18..30, include_blank: false
161
161
  assert_no_select 'select option[value=]'
162
162
  end
163
163
 
164
- test 'input should not set include blank if prompt is given' do
164
+ test 'input does not set include blank if prompt is given' do
165
165
  with_input_for @user, :age, :select, collection: 18..30, prompt: "Please select foo"
166
166
  assert_no_select 'select option[value=]', ''
167
167
  end
168
168
 
169
- test 'input should not set include blank if multiple is given' do
169
+ test 'input does not set include blank if multiple is given' do
170
170
  with_input_for @user, :age, :select, collection: 18..30, input_html: { multiple: true }
171
171
  assert_no_select 'select option[value=]', ''
172
172
  end
173
173
 
174
- test 'input should translate prompt when set to :translate' do
174
+ test 'input translates prompt when set to :translate' do
175
175
  store_translations(:en, simple_form: { prompts: { user: {
176
176
  age: 'Select age:'
177
177
  } } }) do
@@ -180,7 +180,7 @@ class CollectionSelectInputTest < ActionView::TestCase
180
180
  end
181
181
  end
182
182
 
183
- test 'input should translate prompt with a default' do
183
+ test 'input translates prompt with a default' do
184
184
  store_translations(:en, simple_form: { prompts: { defaults: {
185
185
  age: 'Select age:',
186
186
  } } }) do
@@ -189,7 +189,7 @@ class CollectionSelectInputTest < ActionView::TestCase
189
189
  end
190
190
  end
191
191
 
192
- test 'input should not translate prompt when set to a string' do
192
+ test 'input does not translate prompt when set to a string' do
193
193
  store_translations(:en, simple_form: { prompts: { user: {
194
194
  age: 'Select age:'
195
195
  } } }) do
@@ -198,7 +198,7 @@ class CollectionSelectInputTest < ActionView::TestCase
198
198
  end
199
199
  end
200
200
 
201
- test 'input should not translate prompt when set to false' do
201
+ test 'input does not translate prompt when set to false' do
202
202
  store_translations(:en, simple_form: { prompts: { user: {
203
203
  age: 'Select age:'
204
204
  } } }) do
@@ -207,7 +207,7 @@ class CollectionSelectInputTest < ActionView::TestCase
207
207
  end
208
208
  end
209
209
 
210
- test 'input should use Rails prompt translation as a fallback' do
210
+ test 'input uses Rails prompt translation as a fallback' do
211
211
  store_translations(:en, helpers: { select: {
212
212
  prompt: 'Select value:'
213
213
  } }) do
@@ -216,14 +216,14 @@ class CollectionSelectInputTest < ActionView::TestCase
216
216
  end
217
217
  end
218
218
 
219
- test 'input should detect label and value on collections' do
219
+ test 'input detects label and value on collections' do
220
220
  users = [User.build(id: 1, name: "Jose"), User.build(id: 2, name: "Carlos")]
221
221
  with_input_for @user, :description, :select, collection: users
222
222
  assert_select 'select option[value=1]', 'Jose'
223
223
  assert_select 'select option[value=2]', 'Carlos'
224
224
  end
225
225
 
226
- test 'input should disable the anothers components when the option is a object' do
226
+ test 'input disables the anothers components when the option is a object' do
227
227
  with_input_for @user, :description, :select, collection: ["Jose", "Carlos"], disabled: true
228
228
  assert_no_select 'select option[value=Jose][disabled=disabled]', 'Jose'
229
229
  assert_no_select 'select option[value=Carlos][disabled=disabled]', 'Carlos'
@@ -231,7 +231,7 @@ class CollectionSelectInputTest < ActionView::TestCase
231
231
  assert_select 'div.disabled'
232
232
  end
233
233
 
234
- test 'input should not disable the anothers components when the option is a object' do
234
+ test 'input does not disable the anothers components when the option is a object' do
235
235
  with_input_for @user, :description, :select, collection: ["Jose", "Carlos"], disabled: 'Jose'
236
236
  assert_select 'select option[value=Jose][disabled=disabled]', 'Jose'
237
237
  assert_no_select 'select option[value=Carlos][disabled=disabled]', 'Carlos'
@@ -239,7 +239,7 @@ class CollectionSelectInputTest < ActionView::TestCase
239
239
  assert_no_select 'div.disabled'
240
240
  end
241
241
 
242
- test 'input should allow overriding label and value method using a lambda for collection selects' do
242
+ test 'input allows overriding label and value method using a lambda for collection selects' do
243
243
  with_input_for @user, :name, :select,
244
244
  collection: ['Jose', 'Carlos'],
245
245
  label_method: lambda { |i| i.upcase },
@@ -248,7 +248,7 @@ class CollectionSelectInputTest < ActionView::TestCase
248
248
  assert_select 'select option[value=carlos]', "CARLOS"
249
249
  end
250
250
 
251
- test 'input should allow overriding only label but not value method using a lambda for collection select' do
251
+ test 'input allows overriding only label but not value method using a lambda for collection select' do
252
252
  with_input_for @user, :name, :select,
253
253
  collection: ['Jose', 'Carlos'],
254
254
  label_method: lambda { |i| i.upcase }
@@ -256,7 +256,7 @@ class CollectionSelectInputTest < ActionView::TestCase
256
256
  assert_select 'select option[value=Carlos]', "CARLOS"
257
257
  end
258
258
 
259
- test 'input should allow overriding only value but not label method using a lambda for collection select' do
259
+ test 'input allows overriding only value but not label method using a lambda for collection select' do
260
260
  with_input_for @user, :name, :select,
261
261
  collection: ['Jose', 'Carlos'],
262
262
  value_method: lambda { |i| i.downcase }
@@ -264,39 +264,39 @@ class CollectionSelectInputTest < ActionView::TestCase
264
264
  assert_select 'select option[value=carlos]', "Carlos"
265
265
  end
266
266
 
267
- test 'input should allow symbols for collections' do
267
+ test 'input allows symbols for collections' do
268
268
  with_input_for @user, :name, :select, collection: [:jose, :carlos]
269
269
  assert_select 'select.select#user_name'
270
270
  assert_select 'select option[value=jose]', 'jose'
271
271
  assert_select 'select option[value=carlos]', 'carlos'
272
272
  end
273
273
 
274
- test 'collection input with select type should generate required html attribute only with blank option' do
274
+ test 'collection input with select type generates required html attribute only with blank option' do
275
275
  with_input_for @user, :name, :select, include_blank: true, collection: ['Jose', 'Carlos']
276
276
  assert_select 'select.required'
277
277
  assert_select 'select[required]'
278
278
  end
279
279
 
280
- test 'collection input with select type should generate required html attribute only with blank option or prompt' do
280
+ test 'collection input with select type generates required html attribute only with blank option or prompt' do
281
281
  with_input_for @user, :name, :select, prompt: 'Name...', collection: ['Jose', 'Carlos']
282
282
  assert_select 'select.required'
283
283
  assert_select 'select[required]'
284
284
  end
285
285
 
286
- test 'collection input with select type should not generate required html attribute without blank option' do
286
+ test 'collection input with select type does not generate required html attribute without blank option' do
287
287
  with_input_for @user, :name, :select, include_blank: false, collection: ['Jose', 'Carlos']
288
288
  assert_select 'select.required'
289
289
  assert_no_select 'select[required]'
290
290
  assert_no_select 'select[aria-required=true]'
291
291
  end
292
292
 
293
- test 'collection input with select type with multiple attribute should generate required html attribute without blank option' do
293
+ test 'collection input with select type with multiple attribute generates required html attribute without blank option' do
294
294
  with_input_for @user, :name, :select, include_blank: false, input_html: { multiple: true }, collection: ['Jose', 'Carlos']
295
295
  assert_select 'select.required'
296
296
  assert_select 'select[required]'
297
297
  end
298
298
 
299
- test 'collection input with select type with multiple attribute should generate required html attribute with blank option' do
299
+ test 'collection input with select type with multiple attribute generates required html attribute with blank option' do
300
300
  with_input_for @user, :name, :select, include_blank: true, input_html: { multiple: true }, collection: ['Jose', 'Carlos']
301
301
  assert_select 'select.required'
302
302
  assert_select 'select[required]'
@@ -326,7 +326,7 @@ class CollectionSelectInputTest < ActionView::TestCase
326
326
  assert_select 'select[aria-required]'
327
327
  end
328
328
 
329
- test 'input should allow disabled options with a lambda for collection select' do
329
+ test 'input allows disabled options with a lambda for collection select' do
330
330
  with_input_for @user, :name, :select, collection: ["Carlos", "Antonio"],
331
331
  disabled: lambda { |x| x == "Carlos" }
332
332
  assert_select 'select option[value=Carlos][disabled=disabled]', 'Carlos'
@@ -334,7 +334,7 @@ class CollectionSelectInputTest < ActionView::TestCase
334
334
  assert_no_select 'select option[value=Antonio][disabled]'
335
335
  end
336
336
 
337
- test 'input should allow disabled and label method with lambdas for collection select' do
337
+ test 'input allows disabled and label method with lambdas for collection select' do
338
338
  with_input_for @user, :name, :select, collection: ["Carlos", "Antonio"],
339
339
  disabled: lambda { |x| x == "Carlos" }, label_method: lambda { |x| x.upcase }
340
340
  assert_select 'select option[value=Carlos][disabled=disabled]', 'CARLOS'
@@ -342,7 +342,7 @@ class CollectionSelectInputTest < ActionView::TestCase
342
342
  assert_no_select 'select option[value=Antonio][disabled]'
343
343
  end
344
344
 
345
- test 'input should allow a non lambda disabled option with lambda label method for collections' do
345
+ test 'input allows a non lambda disabled option with lambda label method for collections' do
346
346
  with_input_for @user, :name, :select, collection: ["Carlos", "Antonio"],
347
347
  disabled: "Carlos", label_method: lambda { |x| x.upcase }
348
348
  assert_select 'select option[value=Carlos][disabled=disabled]', 'CARLOS'
@@ -350,7 +350,7 @@ class CollectionSelectInputTest < ActionView::TestCase
350
350
  assert_no_select 'select option[value=Antonio][disabled]'
351
351
  end
352
352
 
353
- test 'input should allow selected and label method with lambdas for collection select' do
353
+ test 'input allows selected and label method with lambdas for collection select' do
354
354
  with_input_for @user, :name, :select, collection: ["Carlos", "Antonio"],
355
355
  selected: lambda { |x| x == "Carlos" }, label_method: lambda { |x| x.upcase }
356
356
  assert_select 'select option[value=Carlos][selected=selected]', 'CARLOS'
@@ -358,7 +358,7 @@ class CollectionSelectInputTest < ActionView::TestCase
358
358
  assert_no_select 'select option[value=Antonio][selected]'
359
359
  end
360
360
 
361
- test 'input should allow a non lambda selected option with lambda label method for collection select' do
361
+ test 'input allows a non lambda selected option with lambda label method for collection select' do
362
362
  with_input_for @user, :name, :select, collection: ["Carlos", "Antonio"],
363
363
  selected: "Carlos", label_method: lambda { |x| x.upcase }
364
364
  assert_select 'select option[value=Carlos][selected=selected]', 'CARLOS'
@@ -366,7 +366,7 @@ class CollectionSelectInputTest < ActionView::TestCase
366
366
  assert_no_select 'select option[value=Antonio][selected]'
367
367
  end
368
368
 
369
- test 'input should not override default selection through attribute value with label method as lambda for collection select' do
369
+ test 'input does not override default selection through attribute value with label method as lambda for collection select' do
370
370
  @user.name = "Carlos"
371
371
  with_input_for @user, :name, :select, collection: ["Carlos", "Antonio"],
372
372
  label_method: lambda { |x| x.upcase }