simple_form 3.1.0.rc1 → 3.1.0

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.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -1
  3. data/README.md +64 -16
  4. data/lib/generators/simple_form/install_generator.rb +2 -2
  5. data/lib/generators/simple_form/templates/config/initializers/simple_form.rb +9 -4
  6. data/lib/generators/simple_form/templates/config/initializers/simple_form_bootstrap.rb +45 -15
  7. data/lib/generators/simple_form/templates/config/initializers/simple_form_foundation.rb +85 -4
  8. data/lib/simple_form/action_view_extensions/builder.rb +1 -0
  9. data/lib/simple_form/action_view_extensions/form_helper.rb +5 -1
  10. data/lib/simple_form/components/errors.rb +3 -5
  11. data/lib/simple_form/components/labels.rb +1 -1
  12. data/lib/simple_form/form_builder.rb +34 -19
  13. data/lib/simple_form/inputs/boolean_input.rb +8 -5
  14. data/lib/simple_form/inputs/collection_input.rb +2 -4
  15. data/lib/simple_form/tags.rb +3 -4
  16. data/lib/simple_form/version.rb +1 -1
  17. data/lib/simple_form/wrappers/builder.rb +2 -2
  18. data/lib/simple_form/wrappers/many.rb +1 -0
  19. data/lib/simple_form.rb +21 -2
  20. data/test/action_view_extensions/builder_test.rb +34 -34
  21. data/test/action_view_extensions/form_helper_test.rb +33 -14
  22. data/test/components/label_test.rb +36 -36
  23. data/test/form_builder/association_test.rb +41 -41
  24. data/test/form_builder/button_test.rb +10 -10
  25. data/test/form_builder/error_test.rb +88 -29
  26. data/test/form_builder/general_test.rb +89 -64
  27. data/test/form_builder/hint_test.rb +18 -18
  28. data/test/form_builder/input_field_test.rb +59 -19
  29. data/test/form_builder/label_test.rb +23 -14
  30. data/test/form_builder/wrapper_test.rb +70 -21
  31. data/test/generators/simple_form_generator_test.rb +2 -2
  32. data/test/inputs/boolean_input_test.rb +17 -9
  33. data/test/inputs/collection_check_boxes_input_test.rb +46 -7
  34. data/test/inputs/collection_radio_buttons_input_test.rb +65 -26
  35. data/test/inputs/collection_select_input_test.rb +62 -62
  36. data/test/inputs/datetime_input_test.rb +24 -24
  37. data/test/inputs/disabled_test.rb +15 -15
  38. data/test/inputs/discovery_test.rb +44 -5
  39. data/test/inputs/file_input_test.rb +2 -2
  40. data/test/inputs/general_test.rb +20 -20
  41. data/test/inputs/grouped_collection_select_input_test.rb +10 -10
  42. data/test/inputs/hidden_input_test.rb +4 -4
  43. data/test/inputs/numeric_input_test.rb +43 -43
  44. data/test/inputs/priority_input_test.rb +13 -13
  45. data/test/inputs/readonly_test.rb +19 -19
  46. data/test/inputs/required_test.rb +13 -13
  47. data/test/inputs/string_input_test.rb +33 -33
  48. data/test/inputs/text_input_test.rb +7 -7
  49. data/test/support/discovery_inputs.rb +20 -0
  50. data/test/support/misc_helpers.rb +28 -0
  51. data/test/support/models.rb +13 -2
  52. data/test/test_helper.rb +5 -1
  53. metadata +4 -4
@@ -16,7 +16,7 @@ module SimpleForm
16
16
  end
17
17
 
18
18
  def label_input(wrapper_options = nil)
19
- if options[:label] == false
19
+ if options[:label] == false || inline_label?
20
20
  input(wrapper_options)
21
21
  elsif nested_boolean_style?
22
22
  html_options = label_html_options.dup
@@ -41,7 +41,7 @@ module SimpleForm
41
41
  # which won't generate the hidden checkbox. This is the default functionality
42
42
  # in Rails > 3.2.1, and is backported in SimpleForm AV helpers.
43
43
  def build_check_box(unchecked_value, options)
44
- @builder.check_box(attribute_name, input_html_options, checked_value, unchecked_value)
44
+ @builder.check_box(attribute_name, options, checked_value, unchecked_value)
45
45
  end
46
46
 
47
47
  # Build a checkbox without generating the hidden field. See
@@ -61,13 +61,16 @@ module SimpleForm
61
61
  @builder.hidden_field(attribute_name, options)
62
62
  end
63
63
 
64
+ def inline_label?
65
+ nested_boolean_style? && options[:inline_label]
66
+ end
67
+
64
68
  def inline_label
65
69
  inline_option = options[:inline_label]
66
70
 
67
71
  if inline_option
68
- label = inline_option == true ? " #{label_text}" : " #{html_escape(inline_option)}"
69
-
70
- label.html_safe
72
+ label = inline_option == true ? label_text : html_escape(inline_option)
73
+ " #{label}".html_safe
71
74
  end
72
75
  end
73
76
 
@@ -21,10 +21,8 @@ module SimpleForm
21
21
  options = super
22
22
 
23
23
  options[:include_blank] = true unless skip_include_blank?
24
-
25
- [:prompt, :include_blank].each do |key|
26
- translate_option options, key
27
- end
24
+ translate_option options, :prompt
25
+ translate_option options, :include_blank
28
26
 
29
27
  options
30
28
  end
@@ -16,10 +16,9 @@ module SimpleForm
16
16
  rendered_item = yield item, value, text, default_html_options.merge(additional_html_options)
17
17
 
18
18
  if @options.fetch(:boolean_style, SimpleForm.boolean_style) == :nested
19
- label_options = {}
20
- add_default_name_and_id_for_value(value, label_options)
21
- label_options['for'] = label_options.delete('id')
22
- rendered_item = content_tag(:label, rendered_item, label_options)
19
+ label_options = default_html_options.slice(:index, :namespace)
20
+ label_options['class'] = @options[:item_label_class]
21
+ rendered_item = @template_object.label(@object_name, sanitize_attribute_name(value), rendered_item, label_options)
23
22
  end
24
23
 
25
24
  item_wrapper_tag ? @template_object.content_tag(item_wrapper_tag, rendered_item, class: item_wrapper_class) : rendered_item
@@ -1,3 +1,3 @@
1
1
  module SimpleForm
2
- VERSION = "3.1.0.rc1".freeze
2
+ VERSION = "3.1.0".freeze
3
3
  end
@@ -45,7 +45,7 @@ module SimpleForm
45
45
  @components = []
46
46
  end
47
47
 
48
- def use(name, options = {}, &block)
48
+ def use(name, options = {})
49
49
  if options && wrapper = options[:wrap_with]
50
50
  @components << Single.new(name, wrapper, options.except(:wrap_with))
51
51
  else
@@ -55,7 +55,7 @@ module SimpleForm
55
55
 
56
56
  def optional(name, options = {}, &block)
57
57
  @options[name] = false
58
- use(name, options, &block)
58
+ use(name, options)
59
59
  end
60
60
 
61
61
  def wrapper(name, options = nil)
@@ -50,6 +50,7 @@ module SimpleForm
50
50
 
51
51
  def wrap(input, options, content)
52
52
  return content if options[namespace] == false
53
+ return if defaults[:unless_blank] && content.empty?
53
54
 
54
55
  tag = (namespace && options[:"#{namespace}_tag"]) || @defaults[:tag]
55
56
  return content unless tag
data/lib/simple_form.rb CHANGED
@@ -96,10 +96,16 @@ See https://github.com/plataformatec/simple_form/pull/997 for more information.
96
96
  mattr_accessor :boolean_style
97
97
  @@boolean_style = :inline
98
98
 
99
- # You can define the class to be used on all forms. Default is simple_form.
100
- mattr_accessor :form_class
99
+ # DEPRECATED: You can define the class to be used on all forms. Default is
100
+ # simple_form.
101
+ mattr_reader :form_class
101
102
  @@form_class = :simple_form
102
103
 
104
+ # You can define the default class to be used on all forms. Can be overriden
105
+ # with `html: { :class }`. Defaults to none.
106
+ mattr_accessor :default_form_class
107
+ @@default_form_class = nil
108
+
103
109
  # You can define which elements should obtain additional classes.
104
110
  mattr_accessor :generate_additional_classes_for
105
111
  @@generate_additional_classes_for = [:wrapper, :label, :input]
@@ -130,6 +136,14 @@ See https://github.com/plataformatec/simple_form/pull/997 for more information.
130
136
  mattr_accessor :wrapper_mappings
131
137
  @@wrapper_mappings = nil
132
138
 
139
+ # Namespaces where SimpleForm should look for custom input classes that override
140
+ # default inputs. Namespaces are given as string to allow lazy loading inputs.
141
+ # e.g. config.custom_inputs_namespaces << "CustomInputs"
142
+ # will try to find CustomInputs::NumericInput when an :integer
143
+ # field is called.
144
+ mattr_accessor :custom_inputs_namespaces
145
+ @@custom_inputs_namespaces = []
146
+
133
147
  # Default priority for time_zone inputs.
134
148
  mattr_accessor :time_zone_priority
135
149
  @@time_zone_priority = nil
@@ -241,6 +255,11 @@ See https://github.com/plataformatec/simple_form/pull/997 for more information.
241
255
  ActiveSupport::Deprecation.warn "[SIMPLE_FORM] SimpleForm.default_input_size= is deprecated and has no effect", caller
242
256
  end
243
257
 
258
+ def self.form_class=(value)
259
+ ActiveSupport::Deprecation.warn "[SIMPLE_FORM] SimpleForm.form_class= is deprecated and will be removed in 4.x. Use SimpleForm.default_form_class= instead", caller
260
+ @@form_class = value
261
+ end
262
+
244
263
  # Default way to setup Simple Form. Run rails generate simple_form:install
245
264
  # to create a fresh initializer with all configuration values.
246
265
  def self.setup
@@ -42,7 +42,7 @@ class BuilderTest < ActionView::TestCase
42
42
  assert_select 'form label.collection_radio_buttons[for=user_active_no]', 'No'
43
43
  end
44
44
 
45
- test "collection radio should sanitize collection values for labels correctly" do
45
+ test "collection radio sanitizes collection values for labels correctly" do
46
46
  with_collection_radio_buttons @user, :name, ['$0.99', '$1.99'], :to_s, :to_s
47
47
  assert_select 'label.collection_radio_buttons[for=user_name_099]', '$0.99'
48
48
  assert_select 'label.collection_radio_buttons[for=user_name_199]', '$1.99'
@@ -263,15 +263,15 @@ class BuilderTest < ActionView::TestCase
263
263
  collection = [Tag.new(1, 'Tag 1'), Tag.new(2, 'Tag 2')]
264
264
  with_collection_check_boxes @user, :tag_ids, collection, :id, :name
265
265
 
266
- assert_select 'form input#user_tag_ids_1[type=checkbox][value=1]'
267
- assert_select 'form input#user_tag_ids_2[type=checkbox][value=2]'
266
+ assert_select 'form input#user_tag_ids_1[type=checkbox][value="1"]'
267
+ assert_select 'form input#user_tag_ids_2[type=checkbox][value="2"]'
268
268
  end
269
269
 
270
270
  test "collection check box generates only one hidden field for the entire collection, to ensure something will be sent back to the server when posting an empty collection" do
271
271
  collection = [Tag.new(1, 'Tag 1'), Tag.new(2, 'Tag 2')]
272
272
  with_collection_check_boxes @user, :tag_ids, collection, :id, :name
273
273
 
274
- assert_select "form input[type=hidden][name='user[tag_ids][]'][value=]", count: 1
274
+ assert_select "form input[type=hidden][name='user[tag_ids][]'][value='']", count: 1
275
275
  end
276
276
 
277
277
  test "collection check box accepts a collection and generate a serie of checkboxes with labels for label method" do
@@ -289,7 +289,7 @@ class BuilderTest < ActionView::TestCase
289
289
  assert_select 'form label.collection_check_boxes[for=user_active_no]', 'No'
290
290
  end
291
291
 
292
- test "collection check box should sanitize collection values for labels correctly" do
292
+ test "collection check box sanitizes collection values for labels correctly" do
293
293
  with_collection_check_boxes @user, :name, ['$0.99', '$1.99'], :to_s, :to_s
294
294
  assert_select 'label.collection_check_boxes[for=user_name_099]', '$0.99'
295
295
  assert_select 'label.collection_check_boxes[for=user_name_199]', '$1.99'
@@ -301,36 +301,36 @@ class BuilderTest < ActionView::TestCase
301
301
 
302
302
  with_collection_check_boxes user, :tag_ids, collection, :first, :last
303
303
 
304
- assert_select 'form input[type=checkbox][value=1][checked=checked]'
305
- assert_select 'form input[type=checkbox][value=3][checked=checked]'
306
- assert_no_select 'form input[type=checkbox][value=2][checked=checked]'
304
+ assert_select 'form input[type=checkbox][value="1"][checked=checked]'
305
+ assert_select 'form input[type=checkbox][value="3"][checked=checked]'
306
+ assert_no_select 'form input[type=checkbox][value="2"][checked=checked]'
307
307
  end
308
308
 
309
309
  test "collection check box accepts selected values as :checked option" do
310
310
  collection = (1..3).map { |i| [i, "Tag #{i}"] }
311
311
  with_collection_check_boxes @user, :tag_ids, collection, :first, :last, checked: [1, 3]
312
312
 
313
- assert_select 'form input[type=checkbox][value=1][checked=checked]'
314
- assert_select 'form input[type=checkbox][value=3][checked=checked]'
315
- assert_no_select 'form input[type=checkbox][value=2][checked=checked]'
313
+ assert_select 'form input[type=checkbox][value="1"][checked=checked]'
314
+ assert_select 'form input[type=checkbox][value="3"][checked=checked]'
315
+ assert_no_select 'form input[type=checkbox][value="2"][checked=checked]'
316
316
  end
317
317
 
318
318
  test "collection check boxes accepts selected string values as :checked option" do
319
319
  collection = (1..3).map { |i| [i, "Category #{i}"] }
320
320
  with_collection_check_boxes :user, :category_ids, collection, :first, :last, checked: ['1', '3']
321
321
 
322
- assert_select 'input[type=checkbox][value=1][checked=checked]'
323
- assert_select 'input[type=checkbox][value=3][checked=checked]'
324
- assert_no_select 'input[type=checkbox][value=2][checked=checked]'
322
+ assert_select 'input[type=checkbox][value="1"][checked=checked]'
323
+ assert_select 'input[type=checkbox][value="3"][checked=checked]'
324
+ assert_no_select 'input[type=checkbox][value="2"][checked=checked]'
325
325
  end
326
326
 
327
327
  test "collection check box accepts a single checked value" do
328
328
  collection = (1..3).map { |i| [i, "Tag #{i}"] }
329
329
  with_collection_check_boxes @user, :tag_ids, collection, :first, :last, checked: 3
330
330
 
331
- assert_select 'form input[type=checkbox][value=3][checked=checked]'
332
- assert_no_select 'form input[type=checkbox][value=1][checked=checked]'
333
- assert_no_select 'form input[type=checkbox][value=2][checked=checked]'
331
+ assert_select 'form input[type=checkbox][value="3"][checked=checked]'
332
+ assert_no_select 'form input[type=checkbox][value="1"][checked=checked]'
333
+ assert_no_select 'form input[type=checkbox][value="2"][checked=checked]'
334
334
  end
335
335
 
336
336
  test "collection check box accepts selected values as :checked option and override the model values" do
@@ -338,44 +338,44 @@ class BuilderTest < ActionView::TestCase
338
338
  @user.tag_ids = [2]
339
339
  with_collection_check_boxes @user, :tag_ids, collection, :first, :last, checked: [1, 3]
340
340
 
341
- assert_select 'form input[type=checkbox][value=1][checked=checked]'
342
- assert_select 'form input[type=checkbox][value=3][checked=checked]'
343
- assert_no_select 'form input[type=checkbox][value=2][checked=checked]'
341
+ assert_select 'form input[type=checkbox][value="1"][checked=checked]'
342
+ assert_select 'form input[type=checkbox][value="3"][checked=checked]'
343
+ assert_no_select 'form input[type=checkbox][value="2"][checked=checked]'
344
344
  end
345
345
 
346
346
  test "collection check box accepts multiple disabled items" do
347
347
  collection = (1..3).map { |i| [i, "Tag #{i}"] }
348
348
  with_collection_check_boxes @user, :tag_ids, collection, :first, :last, disabled: [1, 3]
349
349
 
350
- assert_select 'form input[type=checkbox][value=1][disabled=disabled]'
351
- assert_select 'form input[type=checkbox][value=3][disabled=disabled]'
352
- assert_no_select 'form input[type=checkbox][value=2][disabled=disabled]'
350
+ assert_select 'form input[type=checkbox][value="1"][disabled=disabled]'
351
+ assert_select 'form input[type=checkbox][value="3"][disabled=disabled]'
352
+ assert_no_select 'form input[type=checkbox][value="2"][disabled=disabled]'
353
353
  end
354
354
 
355
355
  test "collection check box accepts single disable item" do
356
356
  collection = (1..3).map { |i| [i, "Tag #{i}"] }
357
357
  with_collection_check_boxes @user, :tag_ids, collection, :first, :last, disabled: 1
358
358
 
359
- assert_select 'form input[type=checkbox][value=1][disabled=disabled]'
360
- assert_no_select 'form input[type=checkbox][value=3][disabled=disabled]'
361
- assert_no_select 'form input[type=checkbox][value=2][disabled=disabled]'
359
+ assert_select 'form input[type=checkbox][value="1"][disabled=disabled]'
360
+ assert_no_select 'form input[type=checkbox][value="3"][disabled=disabled]'
361
+ assert_no_select 'form input[type=checkbox][value="2"][disabled=disabled]'
362
362
  end
363
363
 
364
364
  test "collection check box accepts a proc to disabled items" do
365
365
  collection = (1..3).map { |i| [i, "Tag #{i}"] }
366
366
  with_collection_check_boxes @user, :tag_ids, collection, :first, :last, disabled: proc { |i| i.first == 1 }
367
367
 
368
- assert_select 'form input[type=checkbox][value=1][disabled=disabled]'
369
- assert_no_select 'form input[type=checkbox][value=3][disabled=disabled]'
370
- assert_no_select 'form input[type=checkbox][value=2][disabled=disabled]'
368
+ assert_select 'form input[type=checkbox][value="1"][disabled=disabled]'
369
+ assert_no_select 'form input[type=checkbox][value="3"][disabled=disabled]'
370
+ assert_no_select 'form input[type=checkbox][value="2"][disabled=disabled]'
371
371
  end
372
372
 
373
373
  test "collection check box accepts html options" do
374
374
  collection = [[1, 'Tag 1'], [2, 'Tag 2']]
375
375
  with_collection_check_boxes @user, :tag_ids, collection, :first, :last, {}, class: 'check'
376
376
 
377
- assert_select 'form input.check[type=checkbox][value=1]'
378
- assert_select 'form input.check[type=checkbox][value=2]'
377
+ assert_select 'form input.check[type=checkbox][value="1"]'
378
+ assert_select 'form input.check[type=checkbox][value="2"]'
379
379
  end
380
380
 
381
381
  test "collection check box with fields for" do
@@ -386,8 +386,8 @@ class BuilderTest < ActionView::TestCase
386
386
  end
387
387
  end
388
388
 
389
- assert_select 'form input#user_post_tag_ids_1[type=checkbox][value=1]'
390
- assert_select 'form input#user_post_tag_ids_2[type=checkbox][value=2]'
389
+ assert_select 'form input#user_post_tag_ids_1[type=checkbox][value="1"]'
390
+ assert_select 'form input#user_post_tag_ids_2[type=checkbox][value="2"]'
391
391
 
392
392
  assert_select 'form label.collection_check_boxes[for=user_post_tag_ids_1]', 'Tag 1'
393
393
  assert_select 'form label.collection_check_boxes[for=user_post_tag_ids_2]', 'Tag 2'
@@ -593,7 +593,7 @@ class BuilderTest < ActionView::TestCase
593
593
  end
594
594
  end
595
595
 
596
- test "fields inherites wrapper option from the parent form" do
596
+ test "fields inherits wrapper option from the parent form" do
597
597
  swap_wrapper :another do
598
598
  simple_form_for(:user, wrapper: :another) do |f|
599
599
  f.simple_fields_for(:company) do |company|
@@ -8,17 +8,36 @@ class FormHelperTest < ActionView::TestCase
8
8
  end
9
9
  end
10
10
 
11
- test 'SimpleForm should add default class to form' do
11
+ test 'SimpleForm adds default class to form' do
12
12
  with_concat_form_for(:user)
13
13
  assert_select 'form.simple_form'
14
14
  end
15
15
 
16
- test 'SimpleForm should use default browser validations by default' do
16
+ test 'SimpleForm allows overriding default form class' do
17
+ swap SimpleForm, default_form_class: "my_custom_class" do
18
+ with_concat_form_for :user, html: { class: "override_class" }
19
+ assert_no_select 'form.my_custom_class'
20
+ assert_select 'form.override_class'
21
+ end
22
+ end
23
+
24
+ # Remove this test when SimpleForm.form_class is removed in 4.x
25
+ test 'SimpleForm allows overriding default form class, but not form class' do
26
+ ActiveSupport::Deprecation.silence do
27
+ swap SimpleForm, form_class: "fixed_class", default_form_class: "my_custom_class" do
28
+ with_concat_form_for :user, html: { class: "override_class" }
29
+ assert_no_select 'form.my_custom_class'
30
+ assert_select 'form.fixed_class.override_class'
31
+ end
32
+ end
33
+ end
34
+
35
+ test 'SimpleForm uses default browser validations by default' do
17
36
  with_concat_form_for(:user)
18
37
  assert_no_select 'form[novalidate]'
19
38
  end
20
39
 
21
- test 'SimpleForm should not use default browser validations if specified in the configuration options' do
40
+ test 'SimpleForm does not use default browser validations if specified in the configuration options' do
22
41
  swap SimpleForm, browser_validations: false do
23
42
  with_concat_form_for(:user)
24
43
  assert_select 'form[novalidate="novalidate"]'
@@ -37,57 +56,57 @@ class FormHelperTest < ActionView::TestCase
37
56
  end
38
57
  end
39
58
 
40
- test 'SimpleForm should add object name as css class to form when object is not present' do
59
+ test 'SimpleForm adds object name as css class to form when object is not present' do
41
60
  with_concat_form_for(:user, html: { novalidate: true })
42
61
  assert_select 'form.simple_form.user'
43
62
  end
44
63
 
45
- test 'SimpleForm should add :as option as css class to form when object is not present' do
64
+ test 'SimpleForm adds :as option as css class to form when object is not present' do
46
65
  with_concat_form_for(:user, as: 'superuser')
47
66
  assert_select 'form.simple_form.superuser'
48
67
  end
49
68
 
50
- test 'SimpleForm should add object class name with new prefix as css class to form if record is not persisted' do
69
+ test 'SimpleForm adds object class name with new prefix as css class to form if record is not persisted' do
51
70
  @user.new_record!
52
71
  with_concat_form_for(@user)
53
72
  assert_select 'form.simple_form.new_user'
54
73
  end
55
74
 
56
- test 'SimpleForm should add :as option with new prefix as css class to form if record is not persisted' do
75
+ test 'SimpleForm adds :as option with new prefix as css class to form if record is not persisted' do
57
76
  @user.new_record!
58
77
  with_concat_form_for(@user, as: 'superuser')
59
78
  assert_select 'form.simple_form.new_superuser'
60
79
  end
61
80
 
62
- test 'SimpleForm should add edit class prefix as css class to form if record is persisted' do
81
+ test 'SimpleForm adds edit class prefix as css class to form if record is persisted' do
63
82
  with_concat_form_for(@user)
64
83
  assert_select 'form.simple_form.edit_user'
65
84
  end
66
85
 
67
- test 'SimpleForm should add :as options with edit prefix as css class to form if record is persisted' do
86
+ test 'SimpleForm adds :as options with edit prefix as css class to form if record is persisted' do
68
87
  with_concat_form_for(@user, as: 'superuser')
69
88
  assert_select 'form.simple_form.edit_superuser'
70
89
  end
71
90
 
72
- test 'SimpleForm should add last object name as css class to form when there is array of objects' do
91
+ test 'SimpleForm adds last object name as css class to form when there is array of objects' do
73
92
  with_concat_form_for([Company.new, @user])
74
93
  assert_select 'form.simple_form.edit_user'
75
94
  end
76
95
 
77
- test 'SimpleForm should not add object class to form if css_class is specified' do
96
+ test 'SimpleForm does not add object class to form if css_class is specified' do
78
97
  with_concat_form_for(:user, html: { class: nil })
79
98
  assert_no_select 'form.user'
80
99
  end
81
100
 
82
- test 'SimpleForm should add custom class to form if css_class is specified' do
101
+ test 'SimpleForm adds custom class to form if css_class is specified' do
83
102
  with_concat_form_for(:user, html: { class: 'my_class' })
84
103
  assert_select 'form.my_class'
85
104
  end
86
105
 
87
- test 'pass options to SimpleForm' do
106
+ test 'passes options to SimpleForm' do
88
107
  with_concat_form_for(:user, url: '/account', html: { id: 'my_form' })
89
108
  assert_select 'form#my_form'
90
- assert_select 'form[action=/account]'
109
+ assert_select 'form[action="/account"]'
91
110
  end
92
111
 
93
112
  test 'form_for yields an instance of FormBuilder' do