formtastic 4.0.0 → 5.0.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.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +13 -13
- data/CHANGELOG.md +10 -1
- data/Gemfile.lock +99 -64
- data/README.md +7 -2
- data/formtastic.gemspec +5 -3
- data/gemfiles/{rails_5.2 → rails_7.0}/Gemfile +1 -1
- data/gemfiles/rails_7.1/Gemfile +5 -0
- data/gemfiles/rails_edge/Gemfile +1 -1
- data/lib/formtastic/action_class_finder.rb +1 -0
- data/lib/formtastic/actions/base.rb +1 -0
- data/lib/formtastic/actions/button_action.rb +1 -0
- data/lib/formtastic/actions/buttonish.rb +1 -0
- data/lib/formtastic/actions/input_action.rb +1 -0
- data/lib/formtastic/actions/link_action.rb +1 -0
- data/lib/formtastic/actions.rb +1 -0
- data/lib/formtastic/deprecation.rb +2 -1
- data/lib/formtastic/engine.rb +1 -0
- data/lib/formtastic/form_builder.rb +1 -0
- data/lib/formtastic/helpers/action_helper.rb +1 -0
- data/lib/formtastic/helpers/actions_helper.rb +1 -0
- data/lib/formtastic/helpers/enum.rb +1 -0
- data/lib/formtastic/helpers/errors_helper.rb +1 -0
- data/lib/formtastic/helpers/fieldset_wrapper.rb +1 -0
- data/lib/formtastic/helpers/file_column_detection.rb +1 -0
- data/lib/formtastic/helpers/form_helper.rb +1 -0
- data/lib/formtastic/helpers/input_helper.rb +2 -4
- data/lib/formtastic/helpers/inputs_helper.rb +2 -1
- data/lib/formtastic/helpers/reflection.rb +1 -0
- data/lib/formtastic/helpers.rb +1 -1
- data/lib/formtastic/html_attributes.rb +1 -0
- data/lib/formtastic/i18n.rb +1 -0
- data/lib/formtastic/input_class_finder.rb +1 -0
- data/lib/formtastic/inputs/base/associations.rb +1 -0
- data/lib/formtastic/inputs/base/choices.rb +2 -1
- data/lib/formtastic/inputs/base/collections.rb +4 -1
- data/lib/formtastic/inputs/base/database.rb +5 -7
- data/lib/formtastic/inputs/base/datetime_pickerish.rb +1 -0
- data/lib/formtastic/inputs/base/errors.rb +3 -2
- data/lib/formtastic/inputs/base/fileish.rb +1 -0
- data/lib/formtastic/inputs/base/hints.rb +1 -0
- data/lib/formtastic/inputs/base/html.rb +2 -1
- data/lib/formtastic/inputs/base/labelling.rb +3 -2
- data/lib/formtastic/inputs/base/naming.rb +1 -0
- data/lib/formtastic/inputs/base/numeric.rb +1 -0
- data/lib/formtastic/inputs/base/options.rb +1 -0
- data/lib/formtastic/inputs/base/placeholder.rb +1 -0
- data/lib/formtastic/inputs/base/stringish.rb +1 -0
- data/lib/formtastic/inputs/base/timeish.rb +4 -3
- data/lib/formtastic/inputs/base/validations.rb +2 -1
- data/lib/formtastic/inputs/base/wrapping.rb +1 -0
- data/lib/formtastic/inputs/base.rb +3 -2
- data/lib/formtastic/inputs/boolean_input.rb +2 -1
- data/lib/formtastic/inputs/check_boxes_input.rb +2 -1
- data/lib/formtastic/inputs/color_input.rb +1 -0
- data/lib/formtastic/inputs/country_input.rb +1 -0
- data/lib/formtastic/inputs/datalist_input.rb +1 -0
- data/lib/formtastic/inputs/date_picker_input.rb +1 -0
- data/lib/formtastic/inputs/date_select_input.rb +1 -0
- data/lib/formtastic/inputs/datetime_picker_input.rb +1 -0
- data/lib/formtastic/inputs/datetime_select_input.rb +1 -0
- data/lib/formtastic/inputs/email_input.rb +1 -0
- data/lib/formtastic/inputs/file_input.rb +1 -0
- data/lib/formtastic/inputs/hidden_input.rb +3 -2
- data/lib/formtastic/inputs/number_input.rb +1 -0
- data/lib/formtastic/inputs/password_input.rb +1 -0
- data/lib/formtastic/inputs/phone_input.rb +1 -0
- data/lib/formtastic/inputs/radio_input.rb +1 -0
- data/lib/formtastic/inputs/range_input.rb +1 -0
- data/lib/formtastic/inputs/search_input.rb +1 -0
- data/lib/formtastic/inputs/select_input.rb +1 -0
- data/lib/formtastic/inputs/string_input.rb +1 -0
- data/lib/formtastic/inputs/text_input.rb +1 -0
- data/lib/formtastic/inputs/time_picker_input.rb +1 -0
- data/lib/formtastic/inputs/time_select_input.rb +1 -0
- data/lib/formtastic/inputs/time_zone_input.rb +1 -0
- data/lib/formtastic/inputs/url_input.rb +1 -0
- data/lib/formtastic/inputs.rb +1 -0
- data/lib/formtastic/localized_string.rb +1 -0
- data/lib/formtastic/localizer.rb +1 -0
- data/lib/formtastic/namespaced_class_finder.rb +7 -8
- data/lib/formtastic/version.rb +2 -1
- data/lib/formtastic.rb +1 -0
- data/lib/generators/formtastic/form/form_generator.rb +1 -0
- data/lib/generators/formtastic/input/input_generator.rb +1 -0
- data/lib/generators/formtastic/install/install_generator.rb +1 -0
- data/lib/generators/templates/formtastic.rb +1 -0
- data/script/integration-template.rb +2 -3
- data/spec/action_class_finder_spec.rb +1 -0
- data/spec/actions/button_action_spec.rb +17 -16
- data/spec/actions/generic_action_spec.rb +130 -129
- data/spec/actions/input_action_spec.rb +16 -15
- data/spec/actions/link_action_spec.rb +25 -24
- data/spec/builder/custom_builder_spec.rb +5 -4
- data/spec/builder/error_proc_spec.rb +2 -1
- data/spec/builder/semantic_fields_for_spec.rb +26 -25
- data/spec/fast_spec_helper.rb +1 -0
- data/spec/generators/formtastic/form/form_generator_spec.rb +8 -7
- data/spec/generators/formtastic/input/input_generator_spec.rb +1 -0
- data/spec/generators/formtastic/install/install_generator_spec.rb +1 -0
- data/spec/helpers/action_helper_spec.rb +15 -14
- data/spec/helpers/actions_helper_spec.rb +42 -41
- data/spec/helpers/form_helper_spec.rb +26 -19
- data/spec/helpers/input_helper_spec.rb +70 -69
- data/spec/helpers/inputs_helper_spec.rb +179 -179
- data/spec/helpers/reflection_helper_spec.rb +4 -3
- data/spec/helpers/semantic_errors_helper_spec.rb +4 -3
- data/spec/i18n_spec.rb +13 -12
- data/spec/input_class_finder_spec.rb +1 -0
- data/spec/inputs/base/collections_spec.rb +2 -0
- data/spec/inputs/base/validations_spec.rb +1 -0
- data/spec/inputs/boolean_input_spec.rb +66 -65
- data/spec/inputs/check_boxes_input_spec.rb +89 -88
- data/spec/inputs/color_input_spec.rb +7 -6
- data/spec/inputs/country_input_spec.rb +10 -9
- data/spec/inputs/custom_input_spec.rb +1 -0
- data/spec/inputs/datalist_input_spec.rb +2 -1
- data/spec/inputs/date_picker_input_spec.rb +109 -108
- data/spec/inputs/date_select_input_spec.rb +63 -62
- data/spec/inputs/datetime_picker_input_spec.rb +118 -117
- data/spec/inputs/datetime_select_input_spec.rb +72 -71
- data/spec/inputs/email_input_spec.rb +16 -15
- data/spec/inputs/file_input_spec.rb +17 -16
- data/spec/inputs/hidden_input_spec.rb +29 -28
- data/spec/inputs/include_blank_spec.rb +7 -6
- data/spec/inputs/label_spec.rb +25 -24
- data/spec/inputs/number_input_spec.rb +159 -158
- data/spec/inputs/password_input_spec.rb +16 -15
- data/spec/inputs/phone_input_spec.rb +16 -15
- data/spec/inputs/placeholder_spec.rb +17 -16
- data/spec/inputs/radio_input_spec.rb +58 -57
- data/spec/inputs/range_input_spec.rb +108 -107
- data/spec/inputs/readonly_spec.rb +5 -4
- data/spec/inputs/search_input_spec.rb +15 -14
- data/spec/inputs/select_input_spec.rb +144 -93
- data/spec/inputs/string_input_spec.rb +36 -35
- data/spec/inputs/text_input_spec.rb +32 -31
- data/spec/inputs/time_picker_input_spec.rb +110 -109
- data/spec/inputs/time_select_input_spec.rb +71 -70
- data/spec/inputs/time_zone_input_spec.rb +21 -20
- data/spec/inputs/url_input_spec.rb +16 -15
- data/spec/inputs/with_options_spec.rb +8 -7
- data/spec/localizer_spec.rb +1 -0
- data/spec/namespaced_class_finder_spec.rb +17 -5
- data/spec/schema.rb +1 -0
- data/spec/spec_helper.rb +8 -8
- data/spec/support/custom_macros.rb +64 -63
- data/spec/support/deprecation.rb +2 -1
- data/spec/support/shared_examples.rb +2 -1
- data/spec/support/specialized_class_finder_shared_example.rb +1 -0
- data/spec/support/test_environment.rb +1 -0
- metadata +29 -14
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
|
+
# frozen_string_literal: true
|
|
2
3
|
|
|
3
4
|
module CustomMacros
|
|
4
5
|
|
|
@@ -10,67 +11,67 @@ module CustomMacros
|
|
|
10
11
|
|
|
11
12
|
def it_should_have_input_wrapper_with_class(class_name)
|
|
12
13
|
it "should have input wrapper with class '#{class_name}'" do
|
|
13
|
-
expect(output_buffer).to have_tag("form li.#{class_name}")
|
|
14
|
+
expect(output_buffer.to_str).to have_tag("form li.#{class_name}")
|
|
14
15
|
end
|
|
15
16
|
end
|
|
16
17
|
|
|
17
18
|
def it_should_have_input_wrapper_with_id(id_string)
|
|
18
19
|
it "should have input wrapper with id '#{id_string}'" do
|
|
19
|
-
expect(output_buffer).to have_tag("form li##{id_string}")
|
|
20
|
+
expect(output_buffer.to_str).to have_tag("form li##{id_string}")
|
|
20
21
|
end
|
|
21
22
|
end
|
|
22
23
|
|
|
23
24
|
def it_should_not_have_a_label
|
|
24
25
|
it "should not have a label" do
|
|
25
|
-
expect(output_buffer).not_to have_tag("form li label")
|
|
26
|
+
expect(output_buffer.to_str).not_to have_tag("form li label")
|
|
26
27
|
end
|
|
27
28
|
end
|
|
28
29
|
|
|
29
30
|
def it_should_have_a_nested_fieldset
|
|
30
31
|
it "should have a nested_fieldset" do
|
|
31
|
-
expect(output_buffer).to have_tag("form li fieldset")
|
|
32
|
+
expect(output_buffer.to_str).to have_tag("form li fieldset")
|
|
32
33
|
end
|
|
33
34
|
end
|
|
34
35
|
|
|
35
36
|
def it_should_have_a_nested_fieldset_with_class(klass)
|
|
36
37
|
it "should have a nested_fieldset with class #{klass}" do
|
|
37
|
-
expect(output_buffer).to have_tag("form li fieldset.#{klass}")
|
|
38
|
+
expect(output_buffer.to_str).to have_tag("form li fieldset.#{klass}")
|
|
38
39
|
end
|
|
39
40
|
end
|
|
40
41
|
|
|
41
42
|
def it_should_have_a_nested_ordered_list_with_class(klass)
|
|
42
43
|
it "should have a nested fieldset with class #{klass}" do
|
|
43
|
-
expect(output_buffer).to have_tag("form li ol.#{klass}")
|
|
44
|
+
expect(output_buffer.to_str).to have_tag("form li ol.#{klass}")
|
|
44
45
|
end
|
|
45
46
|
end
|
|
46
47
|
|
|
47
48
|
def it_should_have_label_with_text(string_or_regex)
|
|
48
49
|
it "should have a label with text '#{string_or_regex}'" do
|
|
49
|
-
expect(output_buffer).to have_tag("form li label", :text => string_or_regex)
|
|
50
|
+
expect(output_buffer.to_str).to have_tag("form li label", :text => string_or_regex)
|
|
50
51
|
end
|
|
51
52
|
end
|
|
52
53
|
|
|
53
54
|
def it_should_have_label_for(element_id)
|
|
54
55
|
it "should have a label for ##{element_id}" do
|
|
55
|
-
expect(output_buffer).to have_tag("form li label.label[@for='#{element_id}']")
|
|
56
|
+
expect(output_buffer.to_str).to have_tag("form li label.label[@for='#{element_id}']")
|
|
56
57
|
end
|
|
57
58
|
end
|
|
58
59
|
|
|
59
60
|
def it_should_have_an_inline_label_for(element_id)
|
|
60
61
|
it "should have a label for ##{element_id}" do
|
|
61
|
-
expect(output_buffer).to have_tag("form li label[@for='#{element_id}']")
|
|
62
|
+
expect(output_buffer.to_str).to have_tag("form li label[@for='#{element_id}']")
|
|
62
63
|
end
|
|
63
64
|
end
|
|
64
65
|
|
|
65
66
|
def it_should_have_input_with_id(element_id)
|
|
66
67
|
it "should have an input with id '#{element_id}'" do
|
|
67
|
-
expect(output_buffer).to have_tag("form li input##{element_id}")
|
|
68
|
+
expect(output_buffer.to_str).to have_tag("form li input##{element_id}")
|
|
68
69
|
end
|
|
69
70
|
end
|
|
70
71
|
|
|
71
72
|
def it_should_have_select_with_id(element_id)
|
|
72
73
|
it "should have a select box with id '#{element_id}'" do
|
|
73
|
-
expect(output_buffer).to have_tag("form li select##{element_id}")
|
|
74
|
+
expect(output_buffer.to_str).to have_tag("form li select##{element_id}")
|
|
74
75
|
end
|
|
75
76
|
end
|
|
76
77
|
|
|
@@ -78,7 +79,7 @@ module CustomMacros
|
|
|
78
79
|
def it_should_have_tag_with(type, attribute_value_hash)
|
|
79
80
|
attribute_value_hash.each do |attribute, value|
|
|
80
81
|
it "should have a #{type} box with #{attribute} '#{value}'" do
|
|
81
|
-
expect(output_buffer).to have_tag("form li #{type}[@#{attribute}=\"#{value}\"]")
|
|
82
|
+
expect(output_buffer.to_str).to have_tag("form li #{type}[@#{attribute}=\"#{value}\"]")
|
|
82
83
|
end
|
|
83
84
|
end
|
|
84
85
|
end
|
|
@@ -88,44 +89,44 @@ module CustomMacros
|
|
|
88
89
|
|
|
89
90
|
def it_should_have_many_tags(type, count)
|
|
90
91
|
it "should have #{count} #{type} tags" do
|
|
91
|
-
expect(output_buffer).to have_tag("form li #{type}", count: count)
|
|
92
|
+
expect(output_buffer.to_str).to have_tag("form li #{type}", count: count)
|
|
92
93
|
end
|
|
93
94
|
end
|
|
94
95
|
|
|
95
96
|
def it_should_have_input_with_type(input_type)
|
|
96
97
|
it "should have a #{input_type} input" do
|
|
97
|
-
expect(output_buffer).to have_tag("form li input[@type=\"#{input_type}\"]")
|
|
98
|
+
expect(output_buffer.to_str).to have_tag("form li input[@type=\"#{input_type}\"]")
|
|
98
99
|
end
|
|
99
100
|
end
|
|
100
101
|
|
|
101
102
|
def it_should_have_input_with_name(name)
|
|
102
103
|
it "should have an input named #{name}" do
|
|
103
|
-
expect(output_buffer).to have_tag("form li input[@name=\"#{name}\"]")
|
|
104
|
+
expect(output_buffer.to_str).to have_tag("form li input[@name=\"#{name}\"]")
|
|
104
105
|
end
|
|
105
106
|
end
|
|
106
107
|
|
|
107
108
|
def it_should_have_select_with_name(name)
|
|
108
109
|
it "should have an input named #{name}" do
|
|
109
|
-
expect(output_buffer).to have_tag("form li select[@name=\"#{name}\"]")
|
|
110
|
+
expect(output_buffer.to_str).to have_tag("form li select[@name=\"#{name}\"]")
|
|
110
111
|
end
|
|
111
112
|
end
|
|
112
113
|
|
|
113
114
|
def it_should_have_textarea_with_name(name)
|
|
114
115
|
it "should have an input named #{name}" do
|
|
115
|
-
expect(output_buffer).to have_tag("form li textarea[@name=\"#{name}\"]")
|
|
116
|
+
expect(output_buffer.to_str).to have_tag("form li textarea[@name=\"#{name}\"]")
|
|
116
117
|
end
|
|
117
118
|
end
|
|
118
119
|
|
|
119
120
|
def it_should_have_textarea_with_id(element_id)
|
|
120
121
|
it "should have an input with id '#{element_id}'" do
|
|
121
|
-
expect(output_buffer).to have_tag("form li textarea##{element_id}")
|
|
122
|
+
expect(output_buffer.to_str).to have_tag("form li textarea##{element_id}")
|
|
122
123
|
end
|
|
123
124
|
end
|
|
124
125
|
|
|
125
126
|
def it_should_have_label_and_input_with_id(element_id)
|
|
126
127
|
it "should have an input with id '#{element_id}'" do
|
|
127
|
-
expect(output_buffer).to have_tag("form li input##{element_id}")
|
|
128
|
-
expect(output_buffer).to have_tag("form li label[@for='#{element_id}']")
|
|
128
|
+
expect(output_buffer.to_str).to have_tag("form li input##{element_id}")
|
|
129
|
+
expect(output_buffer.to_str).to have_tag("form li label[@for='#{element_id}']")
|
|
129
130
|
end
|
|
130
131
|
end
|
|
131
132
|
|
|
@@ -135,7 +136,7 @@ module CustomMacros
|
|
|
135
136
|
concat(semantic_form_for(@new_post) do |builder|
|
|
136
137
|
concat(builder.input(:title, :as => as))
|
|
137
138
|
end)
|
|
138
|
-
expect(output_buffer).to have_tag("form li input[@size='#{Formtastic::FormBuilder.default_text_field_size}']")
|
|
139
|
+
expect(output_buffer.to_str).to have_tag("form li input[@size='#{Formtastic::FormBuilder.default_text_field_size}']")
|
|
139
140
|
end
|
|
140
141
|
end
|
|
141
142
|
end
|
|
@@ -146,8 +147,8 @@ module CustomMacros
|
|
|
146
147
|
concat(semantic_form_for(@new_post) do |builder|
|
|
147
148
|
concat(builder.input(:title, :as => as))
|
|
148
149
|
end)
|
|
149
|
-
expect(output_buffer).to have_tag("form li input")
|
|
150
|
-
expect(output_buffer).not_to have_tag("form li input[@size]")
|
|
150
|
+
expect(output_buffer.to_str).to have_tag("form li input")
|
|
151
|
+
expect(output_buffer.to_str).not_to have_tag("form li input[@size]")
|
|
151
152
|
end
|
|
152
153
|
end
|
|
153
154
|
end
|
|
@@ -157,7 +158,7 @@ module CustomMacros
|
|
|
157
158
|
concat(semantic_form_for(@new_post) do |builder|
|
|
158
159
|
concat(builder.input(:title, :as => as, :input_html => { :class => 'myclass' }))
|
|
159
160
|
end)
|
|
160
|
-
expect(output_buffer).to have_tag("form li input.myclass")
|
|
161
|
+
expect(output_buffer.to_str).to have_tag("form li input.myclass")
|
|
161
162
|
end
|
|
162
163
|
end
|
|
163
164
|
|
|
@@ -166,14 +167,14 @@ module CustomMacros
|
|
|
166
167
|
concat(semantic_form_for(@new_post) do |builder|
|
|
167
168
|
concat(builder.input(:title, :as => as, :input_html => { :id => 'myid' }))
|
|
168
169
|
end)
|
|
169
|
-
expect(output_buffer).to have_tag('form li label[@for="myid"]')
|
|
170
|
+
expect(output_buffer.to_str).to have_tag('form li label[@for="myid"]')
|
|
170
171
|
end
|
|
171
172
|
end
|
|
172
173
|
|
|
173
174
|
def it_should_have_maxlength_matching_column_limit
|
|
174
175
|
it 'should have a maxlength matching column limit' do
|
|
175
176
|
expect(@new_post.column_for_attribute(:title).limit).to eq(50)
|
|
176
|
-
expect(output_buffer).to have_tag("form li input[@maxlength='50']")
|
|
177
|
+
expect(output_buffer.to_str).to have_tag("form li input[@maxlength='50']")
|
|
177
178
|
end
|
|
178
179
|
end
|
|
179
180
|
|
|
@@ -187,7 +188,7 @@ module CustomMacros
|
|
|
187
188
|
concat(builder.input(:title, :as => as))
|
|
188
189
|
end)
|
|
189
190
|
|
|
190
|
-
expect(output_buffer).to have_tag("form li input[@size='#{column_limit_shorted_than_default}']")
|
|
191
|
+
expect(output_buffer.to_str).to have_tag("form li input[@size='#{column_limit_shorted_than_default}']")
|
|
191
192
|
end
|
|
192
193
|
end
|
|
193
194
|
|
|
@@ -207,14 +208,14 @@ module CustomMacros
|
|
|
207
208
|
concat(semantic_form_for(@new_post) do |builder|
|
|
208
209
|
concat(builder.input(:title, :as => type))
|
|
209
210
|
end)
|
|
210
|
-
expect(output_buffer).to have_tag('form li.error')
|
|
211
|
+
expect(output_buffer.to_str).to have_tag('form li.error')
|
|
211
212
|
end
|
|
212
213
|
|
|
213
214
|
it 'should not wrap the input with the Rails default error wrapping' do
|
|
214
215
|
concat(semantic_form_for(@new_post) do |builder|
|
|
215
216
|
concat(builder.input(:title, :as => type))
|
|
216
217
|
end)
|
|
217
|
-
expect(output_buffer).not_to have_tag('div.fieldWithErrors')
|
|
218
|
+
expect(output_buffer.to_str).not_to have_tag('div.fieldWithErrors')
|
|
218
219
|
end
|
|
219
220
|
|
|
220
221
|
it 'should render a paragraph for the errors' do
|
|
@@ -222,7 +223,7 @@ module CustomMacros
|
|
|
222
223
|
concat(semantic_form_for(@new_post) do |builder|
|
|
223
224
|
concat(builder.input(:title, :as => type))
|
|
224
225
|
end)
|
|
225
|
-
expect(output_buffer).to have_tag('form li.error p.inline-errors')
|
|
226
|
+
expect(output_buffer.to_str).to have_tag('form li.error p.inline-errors')
|
|
226
227
|
end
|
|
227
228
|
|
|
228
229
|
it 'should not display an error list' do
|
|
@@ -230,7 +231,7 @@ module CustomMacros
|
|
|
230
231
|
concat(semantic_form_for(@new_post) do |builder|
|
|
231
232
|
concat(builder.input(:title, :as => type))
|
|
232
233
|
end)
|
|
233
|
-
expect(output_buffer).to have_tag('form li.error ul.errors')
|
|
234
|
+
expect(output_buffer.to_str).to have_tag('form li.error ul.errors')
|
|
234
235
|
end
|
|
235
236
|
end
|
|
236
237
|
|
|
@@ -242,15 +243,15 @@ module CustomMacros
|
|
|
242
243
|
end
|
|
243
244
|
|
|
244
245
|
it 'should not apply an errors class to the list item' do
|
|
245
|
-
expect(output_buffer).not_to have_tag('form li.error')
|
|
246
|
+
expect(output_buffer.to_str).not_to have_tag('form li.error')
|
|
246
247
|
end
|
|
247
248
|
|
|
248
249
|
it 'should not render a paragraph for the errors' do
|
|
249
|
-
expect(output_buffer).not_to have_tag('form li.error p.inline-errors')
|
|
250
|
+
expect(output_buffer.to_str).not_to have_tag('form li.error p.inline-errors')
|
|
250
251
|
end
|
|
251
252
|
|
|
252
253
|
it 'should not display an error list' do
|
|
253
|
-
expect(output_buffer).not_to have_tag('form li.error ul.errors')
|
|
254
|
+
expect(output_buffer.to_str).not_to have_tag('form li.error ul.errors')
|
|
254
255
|
end
|
|
255
256
|
end
|
|
256
257
|
|
|
@@ -262,15 +263,15 @@ module CustomMacros
|
|
|
262
263
|
end
|
|
263
264
|
|
|
264
265
|
it 'should not apply an errors class to the list item' do
|
|
265
|
-
expect(output_buffer).not_to have_tag('form li.error')
|
|
266
|
+
expect(output_buffer.to_str).not_to have_tag('form li.error')
|
|
266
267
|
end
|
|
267
268
|
|
|
268
269
|
it 'should not render a paragraph for the errors' do
|
|
269
|
-
expect(output_buffer).not_to have_tag('form li.error p.inline-errors')
|
|
270
|
+
expect(output_buffer.to_str).not_to have_tag('form li.error p.inline-errors')
|
|
270
271
|
end
|
|
271
272
|
|
|
272
273
|
it 'should not display an error list' do
|
|
273
|
-
expect(output_buffer).not_to have_tag('form li.error ul.errors')
|
|
274
|
+
expect(output_buffer.to_str).not_to have_tag('form li.error ul.errors')
|
|
274
275
|
end
|
|
275
276
|
end
|
|
276
277
|
end
|
|
@@ -289,14 +290,14 @@ module CustomMacros
|
|
|
289
290
|
|
|
290
291
|
before do
|
|
291
292
|
@authors = ([::Author.all] * 2).flatten
|
|
292
|
-
output_buffer.
|
|
293
|
+
@output_buffer = ActionView::OutputBuffer.new ''
|
|
293
294
|
end
|
|
294
295
|
|
|
295
296
|
it 'should use the provided collection' do
|
|
296
297
|
concat(semantic_form_for(@new_post) do |builder|
|
|
297
298
|
concat(builder.input(:author, :as => as, :collection => @authors))
|
|
298
299
|
end)
|
|
299
|
-
expect(output_buffer).to have_tag("form li.#{as} #{countable}", :count => @authors.size + (as == :select ? 1 : 0))
|
|
300
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as} #{countable}", :count => @authors.size + (as == :select ? 1 : 0))
|
|
300
301
|
end
|
|
301
302
|
|
|
302
303
|
describe 'and the :collection is an array of strings' do
|
|
@@ -310,8 +311,8 @@ module CustomMacros
|
|
|
310
311
|
end)
|
|
311
312
|
|
|
312
313
|
@categories.each do |value|
|
|
313
|
-
expect(output_buffer).to have_tag("form li.#{as}", :text => /#{value}/)
|
|
314
|
-
expect(output_buffer).to have_tag("form li.#{as} #{countable}[@value='#{value}']")
|
|
314
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as}", :text => /#{value}/)
|
|
315
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as} #{countable}[@value='#{value}']")
|
|
315
316
|
end
|
|
316
317
|
end
|
|
317
318
|
|
|
@@ -324,10 +325,10 @@ module CustomMacros
|
|
|
324
325
|
end
|
|
325
326
|
concat(fields)
|
|
326
327
|
end)
|
|
327
|
-
expect(output_buffer).to have_tag("form li fieldset ol li label[@for='post_author_category_name_general']")
|
|
328
|
-
expect(output_buffer).to have_tag("form li fieldset ol li label[@for='post_author_category_name_design']")
|
|
329
|
-
expect(output_buffer).to have_tag("form li fieldset ol li label[@for='post_author_category_name_development']")
|
|
330
|
-
expect(output_buffer).to have_tag("form li fieldset ol li label[@for='post_author_category_name_quasi-serious_inventions']")
|
|
328
|
+
expect(output_buffer.to_str).to have_tag("form li fieldset ol li label[@for='post_author_category_name_general']")
|
|
329
|
+
expect(output_buffer.to_str).to have_tag("form li fieldset ol li label[@for='post_author_category_name_design']")
|
|
330
|
+
expect(output_buffer.to_str).to have_tag("form li fieldset ol li label[@for='post_author_category_name_development']")
|
|
331
|
+
expect(output_buffer.to_str).to have_tag("form li fieldset ol li label[@for='post_author_category_name_quasi-serious_inventions']")
|
|
331
332
|
end
|
|
332
333
|
end
|
|
333
334
|
end
|
|
@@ -343,8 +344,8 @@ module CustomMacros
|
|
|
343
344
|
end)
|
|
344
345
|
|
|
345
346
|
@categories.each do |label, value|
|
|
346
|
-
expect(output_buffer).to have_tag("form li.#{as}", :text => /#{label}/)
|
|
347
|
-
expect(output_buffer).to have_tag("form li.#{as} #{countable}[@value='#{value}']")
|
|
347
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as}", :text => /#{label}/)
|
|
348
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as} #{countable}[@value='#{value}']")
|
|
348
349
|
end
|
|
349
350
|
end
|
|
350
351
|
end
|
|
@@ -361,9 +362,9 @@ module CustomMacros
|
|
|
361
362
|
|
|
362
363
|
@categories.each do |text, value|
|
|
363
364
|
label = as == :select ? :option : :label
|
|
364
|
-
expect(output_buffer).to have_tag("form li.#{as} #{label}", :text => /#{text}/i)
|
|
365
|
-
expect(output_buffer).to have_tag("form li.#{as} #{countable}[@value='#{value.to_s}']")
|
|
366
|
-
expect(output_buffer).to have_tag("form li.#{as} #{countable}#post_category_name_#{value.to_s}") if as == :radio
|
|
365
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as} #{label}", :text => /#{text}/i)
|
|
366
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as} #{countable}[@value='#{value.to_s}']")
|
|
367
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as} #{countable}#post_category_name_#{value.to_s}") if as == :radio
|
|
367
368
|
end
|
|
368
369
|
end
|
|
369
370
|
end
|
|
@@ -379,8 +380,8 @@ module CustomMacros
|
|
|
379
380
|
concat(builder.input(:category_name, :as => as, :collection => @choices))
|
|
380
381
|
end)
|
|
381
382
|
|
|
382
|
-
expect(output_buffer).to have_tag("form li.#{as} #{countable}#post_category_name_true")
|
|
383
|
-
expect(output_buffer).to have_tag("form li.#{as} #{countable}#post_category_name_false")
|
|
383
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as} #{countable}#post_category_name_true")
|
|
384
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as} #{countable}#post_category_name_false")
|
|
384
385
|
end
|
|
385
386
|
end
|
|
386
387
|
end
|
|
@@ -397,8 +398,8 @@ module CustomMacros
|
|
|
397
398
|
|
|
398
399
|
@categories.each do |value|
|
|
399
400
|
label = as == :select ? :option : :label
|
|
400
|
-
expect(output_buffer).to have_tag("form li.#{as} #{label}", :text => /#{value}/i)
|
|
401
|
-
expect(output_buffer).to have_tag("form li.#{as} #{countable}[@value='#{value.to_s}']")
|
|
401
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as} #{label}", :text => /#{value}/i)
|
|
402
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as} #{countable}[@value='#{value.to_s}']")
|
|
402
403
|
end
|
|
403
404
|
end
|
|
404
405
|
end
|
|
@@ -414,8 +415,8 @@ module CustomMacros
|
|
|
414
415
|
end)
|
|
415
416
|
|
|
416
417
|
@categories.each do |label, value|
|
|
417
|
-
expect(output_buffer).to have_tag("form li.#{as}", :text => /#{label}/)
|
|
418
|
-
expect(output_buffer).to have_tag("form li.#{as} #{countable}[@value='#{value}']")
|
|
418
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as}", :text => /#{label}/)
|
|
419
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as} #{countable}[@value='#{value}']")
|
|
419
420
|
end
|
|
420
421
|
end
|
|
421
422
|
|
|
@@ -434,7 +435,7 @@ module CustomMacros
|
|
|
434
435
|
|
|
435
436
|
it 'should have options with text content from the specified method' do
|
|
436
437
|
::Author.all.each do |author|
|
|
437
|
-
expect(output_buffer).to have_tag("form li.#{as}", :text => /#{author.login}/)
|
|
438
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as}", :text => /#{author.login}/)
|
|
438
439
|
end
|
|
439
440
|
end
|
|
440
441
|
end
|
|
@@ -450,7 +451,7 @@ module CustomMacros
|
|
|
450
451
|
|
|
451
452
|
it 'should have options with the proc applied to each' do
|
|
452
453
|
::Author.all.each do |author|
|
|
453
|
-
expect(output_buffer).to have_tag("form li.#{as}", :text => /#{author.login.reverse}/)
|
|
454
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as}", :text => /#{author.login.reverse}/)
|
|
454
455
|
end
|
|
455
456
|
end
|
|
456
457
|
end
|
|
@@ -469,7 +470,7 @@ module CustomMacros
|
|
|
469
470
|
|
|
470
471
|
it 'should have options with the proc applied to each' do
|
|
471
472
|
::Author.all.each do |author|
|
|
472
|
-
expect(output_buffer).to have_tag("form li.#{as}", :text => /#{author.login.reverse}/)
|
|
473
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as}", :text => /#{author.login.reverse}/)
|
|
473
474
|
end
|
|
474
475
|
end
|
|
475
476
|
end
|
|
@@ -492,7 +493,7 @@ module CustomMacros
|
|
|
492
493
|
|
|
493
494
|
it "should render the options with #{label_method} as the label" do
|
|
494
495
|
::Author.all.each do |author|
|
|
495
|
-
expect(output_buffer).to have_tag("form li.#{as}", :text => /The Label Text/)
|
|
496
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as}", :text => /The Label Text/)
|
|
496
497
|
end
|
|
497
498
|
end
|
|
498
499
|
end
|
|
@@ -513,7 +514,7 @@ module CustomMacros
|
|
|
513
514
|
|
|
514
515
|
it 'should have options with values from specified method' do
|
|
515
516
|
::Author.all.each do |author|
|
|
516
|
-
expect(output_buffer).to have_tag("form li.#{as} #{countable}[@value='#{author.login}']")
|
|
517
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as} #{countable}[@value='#{author.login}']")
|
|
517
518
|
end
|
|
518
519
|
end
|
|
519
520
|
end
|
|
@@ -529,7 +530,7 @@ module CustomMacros
|
|
|
529
530
|
|
|
530
531
|
it 'should have options with the proc applied to each value' do
|
|
531
532
|
::Author.all.each do |author|
|
|
532
|
-
expect(output_buffer).to have_tag("form li.#{as} #{countable}[@value='#{author.login.reverse}']")
|
|
533
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as} #{countable}[@value='#{author.login.reverse}']")
|
|
533
534
|
end
|
|
534
535
|
end
|
|
535
536
|
end
|
|
@@ -548,7 +549,7 @@ module CustomMacros
|
|
|
548
549
|
|
|
549
550
|
it 'should have options with the proc applied to each value' do
|
|
550
551
|
::Author.all.each do |author|
|
|
551
|
-
expect(output_buffer).to have_tag("form li.#{as} #{countable}[@value='#{author.login.reverse}']")
|
|
552
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as} #{countable}[@value='#{author.login.reverse}']")
|
|
552
553
|
end
|
|
553
554
|
end
|
|
554
555
|
end
|
data/spec/support/deprecation.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: formtastic
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 5.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Justin French
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2023-10-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: actionpack
|
|
@@ -16,28 +16,28 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
19
|
+
version: 6.0.0
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
26
|
+
version: 6.0.0
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: rspec-rails
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
|
-
- - "
|
|
31
|
+
- - ">="
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '
|
|
33
|
+
version: '4.0'
|
|
34
34
|
type: :development
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
|
-
- - "
|
|
38
|
+
- - ">="
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '
|
|
40
|
+
version: '4.0'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: rspec-dom-testing
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -52,6 +52,20 @@ dependencies:
|
|
|
52
52
|
- - ">="
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: 0.1.0
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rspec-mocks
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: 3.12.2
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: 3.12.2
|
|
55
69
|
- !ruby/object:Gem::Dependency
|
|
56
70
|
name: yard
|
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -134,9 +148,10 @@ files:
|
|
|
134
148
|
- app/assets/stylesheets/formtastic_ie7.css
|
|
135
149
|
- bin/appraisal
|
|
136
150
|
- formtastic.gemspec
|
|
137
|
-
- gemfiles/rails_5.2/Gemfile
|
|
138
151
|
- gemfiles/rails_6.0/Gemfile
|
|
139
152
|
- gemfiles/rails_6.1/Gemfile
|
|
153
|
+
- gemfiles/rails_7.0/Gemfile
|
|
154
|
+
- gemfiles/rails_7.1/Gemfile
|
|
140
155
|
- gemfiles/rails_edge/Gemfile
|
|
141
156
|
- lib/formtastic.rb
|
|
142
157
|
- lib/formtastic/action_class_finder.rb
|
|
@@ -294,7 +309,7 @@ homepage: http://github.com/formtastic/formtastic
|
|
|
294
309
|
licenses:
|
|
295
310
|
- MIT
|
|
296
311
|
metadata: {}
|
|
297
|
-
post_install_message:
|
|
312
|
+
post_install_message:
|
|
298
313
|
rdoc_options:
|
|
299
314
|
- "--charset=UTF-8"
|
|
300
315
|
require_paths:
|
|
@@ -303,15 +318,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
303
318
|
requirements:
|
|
304
319
|
- - ">="
|
|
305
320
|
- !ruby/object:Gem::Version
|
|
306
|
-
version: 2.
|
|
321
|
+
version: 2.6.0
|
|
307
322
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
308
323
|
requirements:
|
|
309
324
|
- - ">="
|
|
310
325
|
- !ruby/object:Gem::Version
|
|
311
326
|
version: '0'
|
|
312
327
|
requirements: []
|
|
313
|
-
rubygems_version: 3.
|
|
314
|
-
signing_key:
|
|
328
|
+
rubygems_version: 3.3.26
|
|
329
|
+
signing_key:
|
|
315
330
|
specification_version: 4
|
|
316
331
|
summary: A Rails form builder plugin/gem with semantically rich and accessible markup
|
|
317
332
|
test_files:
|