formtastic 2.1.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitattributes +1 -0
- data/.github/workflows/test.yml +61 -0
- data/.gitignore +4 -2
- data/CHANGELOG.md +52 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +105 -0
- data/MIT-LICENSE +1 -1
- data/{README.textile → README.md} +204 -219
- data/RELEASE_PROCESS +3 -1
- data/Rakefile +27 -29
- data/app/assets/stylesheets/formtastic.css +3 -2
- data/bin/appraisal +8 -0
- data/formtastic.gemspec +11 -14
- data/gemfiles/rails_5.2/Gemfile +5 -0
- data/gemfiles/rails_6.0/Gemfile +5 -0
- data/gemfiles/rails_6.1/Gemfile +5 -0
- data/gemfiles/rails_edge/Gemfile +13 -0
- data/lib/formtastic/action_class_finder.rb +18 -0
- data/lib/formtastic/actions/button_action.rb +55 -60
- data/lib/formtastic/actions/input_action.rb +59 -57
- data/lib/formtastic/actions/link_action.rb +68 -67
- data/lib/formtastic/actions.rb +6 -3
- data/lib/formtastic/deprecation.rb +5 -0
- data/lib/formtastic/engine.rb +3 -1
- data/lib/formtastic/form_builder.rb +35 -16
- data/lib/formtastic/helpers/action_helper.rb +34 -28
- data/lib/formtastic/helpers/enum.rb +13 -0
- data/lib/formtastic/helpers/errors_helper.rb +2 -2
- data/lib/formtastic/helpers/fieldset_wrapper.rb +16 -12
- data/lib/formtastic/helpers/form_helper.rb +19 -16
- data/lib/formtastic/helpers/input_helper.rb +69 -97
- data/lib/formtastic/helpers/inputs_helper.rb +35 -25
- data/lib/formtastic/helpers/reflection.rb +4 -4
- data/lib/formtastic/helpers.rb +1 -2
- data/lib/formtastic/html_attributes.rb +12 -1
- data/lib/formtastic/i18n.rb +1 -1
- data/lib/formtastic/input_class_finder.rb +18 -0
- data/lib/formtastic/inputs/base/choices.rb +2 -2
- data/lib/formtastic/inputs/base/collections.rb +46 -14
- data/lib/formtastic/inputs/base/database.rb +7 -2
- data/lib/formtastic/inputs/base/datetime_pickerish.rb +85 -0
- data/lib/formtastic/inputs/base/errors.rb +7 -7
- data/lib/formtastic/inputs/base/hints.rb +2 -2
- data/lib/formtastic/inputs/base/html.rb +10 -9
- data/lib/formtastic/inputs/base/labelling.rb +5 -8
- data/lib/formtastic/inputs/base/naming.rb +4 -4
- data/lib/formtastic/inputs/base/numeric.rb +1 -1
- data/lib/formtastic/inputs/base/options.rb +3 -4
- data/lib/formtastic/inputs/base/stringish.rb +10 -2
- data/lib/formtastic/inputs/base/timeish.rb +34 -22
- data/lib/formtastic/inputs/base/validations.rb +41 -13
- data/lib/formtastic/inputs/base/wrapping.rb +29 -26
- data/lib/formtastic/inputs/base.rb +22 -15
- data/lib/formtastic/inputs/boolean_input.rb +26 -12
- data/lib/formtastic/inputs/check_boxes_input.rb +39 -31
- data/lib/formtastic/inputs/color_input.rb +41 -0
- data/lib/formtastic/inputs/country_input.rb +24 -5
- data/lib/formtastic/inputs/datalist_input.rb +41 -0
- data/lib/formtastic/inputs/date_picker_input.rb +93 -0
- data/lib/formtastic/inputs/{date_input.rb → date_select_input.rb} +1 -1
- data/lib/formtastic/inputs/datetime_picker_input.rb +103 -0
- data/lib/formtastic/inputs/{datetime_input.rb → datetime_select_input.rb} +1 -1
- data/lib/formtastic/inputs/file_input.rb +2 -2
- data/lib/formtastic/inputs/hidden_input.rb +2 -6
- data/lib/formtastic/inputs/radio_input.rb +28 -22
- data/lib/formtastic/inputs/select_input.rb +36 -39
- data/lib/formtastic/inputs/time_picker_input.rb +99 -0
- data/lib/formtastic/inputs/{time_input.rb → time_select_input.rb} +6 -2
- data/lib/formtastic/inputs/time_zone_input.rb +16 -6
- data/lib/formtastic/inputs.rb +32 -21
- data/lib/formtastic/localized_string.rb +1 -1
- data/lib/formtastic/localizer.rb +24 -24
- data/lib/formtastic/namespaced_class_finder.rb +99 -0
- data/lib/formtastic/version.rb +1 -1
- data/lib/formtastic.rb +20 -10
- data/lib/generators/formtastic/form/form_generator.rb +10 -4
- data/lib/generators/formtastic/input/input_generator.rb +46 -0
- data/lib/generators/formtastic/install/install_generator.rb +5 -19
- data/lib/generators/templates/_form.html.slim +2 -2
- data/lib/generators/templates/formtastic.rb +46 -25
- data/lib/generators/templates/input.rb +19 -0
- data/sample/basic_inputs.html +23 -3
- data/script/integration-template.rb +74 -0
- data/script/integration.sh +19 -0
- data/spec/action_class_finder_spec.rb +12 -0
- data/spec/actions/button_action_spec.rb +8 -8
- data/spec/actions/generic_action_spec.rb +92 -56
- data/spec/actions/input_action_spec.rb +7 -7
- data/spec/actions/link_action_spec.rb +10 -10
- data/spec/builder/custom_builder_spec.rb +36 -20
- data/spec/builder/error_proc_spec.rb +4 -4
- data/spec/builder/semantic_fields_for_spec.rb +28 -29
- data/spec/fast_spec_helper.rb +12 -0
- data/spec/generators/formtastic/form/form_generator_spec.rb +45 -32
- data/spec/generators/formtastic/input/input_generator_spec.rb +124 -0
- data/spec/generators/formtastic/install/install_generator_spec.rb +9 -9
- data/spec/helpers/action_helper_spec.rb +75 -103
- data/spec/helpers/actions_helper_spec.rb +17 -17
- data/spec/helpers/form_helper_spec.rb +84 -33
- data/spec/helpers/input_helper_spec.rb +333 -285
- data/spec/helpers/inputs_helper_spec.rb +167 -121
- data/spec/helpers/reflection_helper_spec.rb +3 -3
- data/spec/helpers/semantic_errors_helper_spec.rb +23 -23
- data/spec/i18n_spec.rb +26 -26
- data/spec/input_class_finder_spec.rb +10 -0
- data/spec/inputs/base/collections_spec.rb +76 -0
- data/spec/inputs/base/validations_spec.rb +480 -0
- data/spec/inputs/boolean_input_spec.rb +100 -65
- data/spec/inputs/check_boxes_input_spec.rb +200 -101
- data/spec/inputs/color_input_spec.rb +85 -0
- data/spec/inputs/country_input_spec.rb +20 -20
- data/spec/inputs/custom_input_spec.rb +3 -4
- data/spec/inputs/datalist_input_spec.rb +61 -0
- data/spec/inputs/date_picker_input_spec.rb +449 -0
- data/spec/inputs/date_select_input_spec.rb +249 -0
- data/spec/inputs/datetime_picker_input_spec.rb +490 -0
- data/spec/inputs/datetime_select_input_spec.rb +209 -0
- data/spec/inputs/email_input_spec.rb +5 -5
- data/spec/inputs/file_input_spec.rb +6 -6
- data/spec/inputs/hidden_input_spec.rb +22 -35
- data/spec/inputs/include_blank_spec.rb +11 -11
- data/spec/inputs/label_spec.rb +62 -25
- data/spec/inputs/number_input_spec.rb +112 -112
- data/spec/inputs/password_input_spec.rb +5 -5
- data/spec/inputs/phone_input_spec.rb +5 -5
- data/spec/inputs/placeholder_spec.rb +6 -6
- data/spec/inputs/radio_input_spec.rb +99 -55
- data/spec/inputs/range_input_spec.rb +66 -66
- data/spec/inputs/readonly_spec.rb +50 -0
- data/spec/inputs/search_input_spec.rb +5 -5
- data/spec/inputs/select_input_spec.rb +170 -170
- data/spec/inputs/string_input_spec.rb +68 -16
- data/spec/inputs/text_input_spec.rb +16 -16
- data/spec/inputs/time_picker_input_spec.rb +455 -0
- data/spec/inputs/time_select_input_spec.rb +261 -0
- data/spec/inputs/time_zone_input_spec.rb +54 -28
- data/spec/inputs/url_input_spec.rb +5 -5
- data/spec/inputs/with_options_spec.rb +7 -7
- data/spec/localizer_spec.rb +39 -17
- data/spec/namespaced_class_finder_spec.rb +79 -0
- data/spec/schema.rb +21 -0
- data/spec/spec_helper.rb +254 -221
- data/spec/support/custom_macros.rb +128 -95
- data/spec/support/shared_examples.rb +12 -0
- data/spec/support/specialized_class_finder_shared_example.rb +27 -0
- data/spec/support/test_environment.rb +26 -10
- metadata +177 -238
- data/.travis.yml +0 -8
- data/Appraisals +0 -11
- data/CHANGELOG +0 -371
- data/gemfiles/rails-3.0.gemfile +0 -7
- data/gemfiles/rails-3.1.gemfile +0 -7
- data/gemfiles/rails-3.2.gemfile +0 -7
- data/lib/formtastic/helpers/buttons_helper.rb +0 -310
- data/lib/formtastic/inputs/base/grouped_collections.rb +0 -77
- data/lib/formtastic/util.rb +0 -25
- data/lib/tasks/verify_rcov.rb +0 -44
- data/spec/helpers/buttons_helper_spec.rb +0 -166
- data/spec/helpers/commit_button_helper_spec.rb +0 -530
- data/spec/inputs/date_input_spec.rb +0 -227
- data/spec/inputs/datetime_input_spec.rb +0 -185
- data/spec/inputs/time_input_spec.rb +0 -267
- data/spec/support/deferred_garbage_collection.rb +0 -21
@@ -1,53 +1,61 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
-
describe 'boolean input' do
|
4
|
+
RSpec.describe 'boolean input' do
|
5
5
|
|
6
6
|
include FormtasticSpecHelper
|
7
7
|
|
8
8
|
before do
|
9
9
|
@output_buffer = ''
|
10
10
|
mock_everything
|
11
|
-
|
12
|
-
concat(semantic_form_for(@new_post) do |builder|
|
13
|
-
concat(builder.input(:allow_comments, :as => :boolean))
|
14
|
-
end)
|
15
|
-
end
|
16
|
-
|
17
|
-
it_should_have_input_wrapper_with_class("boolean")
|
18
|
-
it_should_have_input_wrapper_with_class(:input)
|
19
|
-
it_should_have_input_wrapper_with_id("post_allow_comments_input")
|
20
|
-
it_should_apply_error_logic_for_input_type(:boolean)
|
21
|
-
|
22
|
-
it 'should generate a label containing the input' do
|
23
|
-
output_buffer.should_not have_tag('label.label')
|
24
|
-
output_buffer.should have_tag('form li label', :count => 1)
|
25
|
-
output_buffer.should have_tag('form li label[@for="post_allow_comments"]')
|
26
|
-
output_buffer.should have_tag('form li label', /Allow comments/)
|
27
|
-
output_buffer.should have_tag('form li label input[@type="checkbox"]', :count => 1)
|
28
|
-
output_buffer.should have_tag('form li input[@type="hidden"]', :count => 1)
|
29
|
-
output_buffer.should_not have_tag('form li label input[@type="hidden"]', :count => 1) # invalid HTML5
|
30
11
|
end
|
31
12
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
13
|
+
describe 'generic' do
|
14
|
+
before do
|
15
|
+
concat(semantic_form_for(@new_post) do |builder|
|
16
|
+
concat(builder.input(:allow_comments, :as => :boolean))
|
17
|
+
end)
|
18
|
+
end
|
19
|
+
|
20
|
+
it_should_have_input_wrapper_with_class("boolean")
|
21
|
+
it_should_have_input_wrapper_with_class(:input)
|
22
|
+
it_should_have_input_wrapper_with_id("post_allow_comments_input")
|
23
|
+
it_should_apply_error_logic_for_input_type(:boolean)
|
24
|
+
|
25
|
+
it 'should generate a label containing the input' do
|
26
|
+
expect(output_buffer).not_to have_tag('label.label')
|
27
|
+
expect(output_buffer).to have_tag('form li label', :count => 1)
|
28
|
+
expect(output_buffer).to have_tag('form li label[@for="post_allow_comments"]')
|
29
|
+
expect(output_buffer).to have_tag('form li label', :text => /Allow comments/)
|
30
|
+
expect(output_buffer).to have_tag('form li label input[@type="checkbox"]', :count => 1)
|
31
|
+
expect(output_buffer).to have_tag('form li input[@type="hidden"]', :count => 1)
|
32
|
+
expect(output_buffer).not_to have_tag('form li label input[@type="hidden"]', :count => 1) # invalid HTML5
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should not add a "name" attribute to the label' do
|
36
|
+
expect(output_buffer).not_to have_tag('form li label[@name]')
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should generate a checkbox input' do
|
40
|
+
expect(output_buffer).to have_tag('form li label input')
|
41
|
+
expect(output_buffer).to have_tag('form li label input#post_allow_comments')
|
42
|
+
expect(output_buffer).to have_tag('form li label input[@type="checkbox"]')
|
43
|
+
expect(output_buffer).to have_tag('form li label input[@name="post[allow_comments]"]')
|
44
|
+
expect(output_buffer).to have_tag('form li label input[@type="checkbox"][@value="1"]')
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'should generate a checked input if object.method returns true' do
|
48
|
+
expect(output_buffer).to have_tag('form li label input[@checked="checked"]')
|
49
|
+
expect(output_buffer).to have_tag('form li input[@name="post[allow_comments]"]', :count => 2)
|
50
|
+
expect(output_buffer).to have_tag('form li input#post_allow_comments', :count => 1)
|
51
|
+
end
|
44
52
|
end
|
45
53
|
|
46
54
|
it 'should generate a checked input if :input_html is passed :checked => checked' do
|
47
55
|
concat(semantic_form_for(@new_post) do |builder|
|
48
56
|
concat(builder.input(:answer_comments, :as => :boolean, :input_html => {:checked => 'checked'}))
|
49
57
|
end)
|
50
|
-
output_buffer.
|
58
|
+
expect(output_buffer).to have_tag('form li label input[@checked="checked"]')
|
51
59
|
end
|
52
60
|
|
53
61
|
it 'should name the hidden input with the :name html_option' do
|
@@ -55,8 +63,8 @@ describe 'boolean input' do
|
|
55
63
|
concat(builder.input(:answer_comments, :as => :boolean, :input_html => { :name => "foo" }))
|
56
64
|
end)
|
57
65
|
|
58
|
-
output_buffer.
|
59
|
-
output_buffer.
|
66
|
+
expect(output_buffer).to have_tag('form li input[@type="checkbox"][@name="foo"]', :count => 1)
|
67
|
+
expect(output_buffer).to have_tag('form li input[@type="hidden"][@name="foo"]', :count => 1)
|
60
68
|
end
|
61
69
|
|
62
70
|
it 'should name the hidden input with the :name html_option' do
|
@@ -64,73 +72,93 @@ describe 'boolean input' do
|
|
64
72
|
concat(builder.input(:answer_comments, :as => :boolean, :input_html => { :name => "foo" }))
|
65
73
|
end)
|
66
74
|
|
67
|
-
output_buffer.
|
68
|
-
output_buffer.
|
75
|
+
expect(output_buffer).to have_tag('form li input[@type="checkbox"][@name="foo"]', :count => 1)
|
76
|
+
expect(output_buffer).to have_tag('form li input[@type="hidden"][@name="foo"]', :count => 1)
|
69
77
|
end
|
70
78
|
|
71
79
|
it "should generate a disabled input and hidden input if :input_html is passed :disabled => 'disabled' " do
|
72
80
|
concat(semantic_form_for(@new_post) do |builder|
|
73
81
|
concat(builder.input(:allow_comments, :as => :boolean, :input_html => {:disabled => 'disabled'}))
|
74
82
|
end)
|
75
|
-
output_buffer.
|
76
|
-
output_buffer.
|
83
|
+
expect(output_buffer).to have_tag('form li label input[@disabled="disabled"]', :count => 1)
|
84
|
+
expect(output_buffer).to have_tag('form li input[@type="hidden"][@disabled="disabled"]', :count => 1)
|
77
85
|
end
|
78
86
|
|
79
87
|
it 'should generate an input[id] with matching label[for] when id passed in :input_html' do
|
80
88
|
concat(semantic_form_for(@new_post) do |builder|
|
81
89
|
concat(builder.input(:allow_comments, :as => :boolean, :input_html => {:id => 'custom_id'}))
|
82
90
|
end)
|
83
|
-
output_buffer.
|
84
|
-
output_buffer.
|
91
|
+
expect(output_buffer).to have_tag('form li label input[@id="custom_id"]')
|
92
|
+
expect(output_buffer).to have_tag('form li label[@for="custom_id"]')
|
85
93
|
end
|
86
94
|
|
87
95
|
it 'should allow checked and unchecked values to be sent' do
|
88
96
|
concat(semantic_form_for(@new_post) do |builder|
|
89
97
|
concat(builder.input(:allow_comments, :as => :boolean, :checked_value => 'checked', :unchecked_value => 'unchecked'))
|
90
98
|
end)
|
91
|
-
output_buffer.
|
92
|
-
output_buffer.
|
93
|
-
output_buffer.
|
99
|
+
expect(output_buffer).to have_tag('form li label input[@type="checkbox"][@value="checked"]:not([@unchecked_value][@checked_value])')
|
100
|
+
expect(output_buffer).to have_tag('form li input[@type="hidden"][@value="unchecked"]')
|
101
|
+
expect(output_buffer).not_to have_tag('form li label input[@type="hidden"]') # invalid HTML5
|
94
102
|
end
|
95
103
|
|
96
104
|
it 'should generate a checked input if object.method returns checked value' do
|
97
|
-
@new_post.
|
105
|
+
allow(@new_post).to receive(:allow_comments).and_return('yes')
|
98
106
|
|
99
107
|
concat(semantic_form_for(@new_post) do |builder|
|
100
108
|
concat(builder.input(:allow_comments, :as => :boolean, :checked_value => 'yes', :unchecked_value => 'no'))
|
101
109
|
end)
|
102
110
|
|
103
|
-
output_buffer.
|
111
|
+
expect(output_buffer).to have_tag('form li label input[@type="checkbox"][@value="yes"][@checked="checked"]')
|
104
112
|
end
|
105
113
|
|
106
114
|
it 'should not generate a checked input if object.method returns unchecked value' do
|
107
|
-
@new_post.
|
115
|
+
allow(@new_post).to receive(:allow_comments).and_return('no')
|
108
116
|
|
109
117
|
concat(semantic_form_for(@new_post) do |builder|
|
110
118
|
concat(builder.input(:allow_comments, :as => :boolean, :checked_value => 'yes', :unchecked_value => 'no'))
|
111
119
|
end)
|
112
120
|
|
113
|
-
output_buffer.
|
121
|
+
expect(output_buffer).to have_tag('form li label input[@type="checkbox"][@value="yes"]:not([@checked])')
|
114
122
|
end
|
115
123
|
|
116
124
|
it 'should generate a checked input if object.method returns checked value' do
|
117
|
-
@new_post.
|
125
|
+
allow(@new_post).to receive(:allow_comments).and_return('yes')
|
118
126
|
|
119
127
|
concat(semantic_form_for(@new_post) do |builder|
|
120
128
|
concat(builder.input(:allow_comments, :as => :boolean, :checked_value => 'yes', :unchecked_value => 'no'))
|
121
129
|
end)
|
122
130
|
|
123
|
-
output_buffer.
|
131
|
+
expect(output_buffer).to have_tag('form li label input[@type="checkbox"][@value="yes"][@checked="checked"]')
|
132
|
+
end
|
133
|
+
|
134
|
+
it 'should generate a checked input for boolean database values compared to string checked values' do
|
135
|
+
allow(@new_post).to receive(:foo).and_return(1)
|
136
|
+
|
137
|
+
concat(semantic_form_for(@new_post) do |builder|
|
138
|
+
concat(builder.input(:foo, :as => :boolean))
|
139
|
+
end)
|
140
|
+
|
141
|
+
expect(output_buffer).to have_tag('form li label input[@type="checkbox"][@value="1"][@checked="checked"]')
|
142
|
+
end
|
143
|
+
|
144
|
+
it 'should generate a checked input if object.method returns checked value when inverted' do
|
145
|
+
allow(@new_post).to receive(:allow_comments).and_return(0)
|
146
|
+
|
147
|
+
concat(semantic_form_for(@new_post) do |builder|
|
148
|
+
concat(builder.input(:allow_comments, :as => :boolean, :checked_value => 0, :unchecked_value => 1))
|
149
|
+
end)
|
150
|
+
|
151
|
+
expect(output_buffer).to have_tag('form li label input[@type="checkbox"][@value="0"][@checked="checked"]')
|
124
152
|
end
|
125
153
|
|
126
154
|
it 'should not generate a checked input if object.method returns unchecked value' do
|
127
|
-
@new_post.
|
155
|
+
allow(@new_post).to receive(:allow_comments).and_return('no')
|
128
156
|
|
129
157
|
concat(semantic_form_for(@new_post) do |builder|
|
130
158
|
concat(builder.input(:allow_comments, :as => :boolean, :checked_value => 'yes', :unchecked_value => 'no'))
|
131
159
|
end)
|
132
160
|
|
133
|
-
output_buffer.
|
161
|
+
expect(output_buffer).to have_tag('form li label input[@type="checkbox"][@value="yes"]:not([@checked])')
|
134
162
|
end
|
135
163
|
|
136
164
|
it 'should generate a label and a checkbox even if no object is given' do
|
@@ -138,13 +166,21 @@ describe 'boolean input' do
|
|
138
166
|
concat(builder.input(:allow_comments, :as => :boolean))
|
139
167
|
end)
|
140
168
|
|
141
|
-
output_buffer.
|
142
|
-
output_buffer.
|
143
|
-
output_buffer.
|
169
|
+
expect(output_buffer).to have_tag('form li label[@for="project_allow_comments"]')
|
170
|
+
expect(output_buffer).to have_tag('form li label', :text => /Allow comments/)
|
171
|
+
expect(output_buffer).to have_tag('form li label input[@type="checkbox"]')
|
144
172
|
|
145
|
-
output_buffer.
|
146
|
-
output_buffer.
|
147
|
-
output_buffer.
|
173
|
+
expect(output_buffer).to have_tag('form li label input#project_allow_comments')
|
174
|
+
expect(output_buffer).to have_tag('form li label input[@type="checkbox"]')
|
175
|
+
expect(output_buffer).to have_tag('form li label input[@name="project[allow_comments]"]')
|
176
|
+
end
|
177
|
+
|
178
|
+
it 'should not pass input_html options down to the label html' do
|
179
|
+
concat(semantic_form_for(@new_post) do |builder|
|
180
|
+
builder.input(:title, :as => :boolean, :input_html => { :tabindex => 2, :x => "X" })
|
181
|
+
end)
|
182
|
+
expect(output_buffer).not_to have_tag('label[tabindex]')
|
183
|
+
expect(output_buffer).not_to have_tag('label[x]')
|
148
184
|
end
|
149
185
|
|
150
186
|
context "when required" do
|
@@ -154,7 +190,7 @@ describe 'boolean input' do
|
|
154
190
|
concat(semantic_form_for(@new_post) do |builder|
|
155
191
|
concat(builder.input(:title, :as => :boolean, :required => true))
|
156
192
|
end)
|
157
|
-
output_buffer.
|
193
|
+
expect(output_buffer).to have_tag("input[@required]")
|
158
194
|
end
|
159
195
|
end
|
160
196
|
|
@@ -163,7 +199,7 @@ describe 'boolean input' do
|
|
163
199
|
concat(semantic_form_for(@new_post) do |builder|
|
164
200
|
concat(builder.input(:title, :as => :boolean))
|
165
201
|
end)
|
166
|
-
output_buffer.
|
202
|
+
expect(output_buffer).not_to have_tag("input[@required]")
|
167
203
|
end
|
168
204
|
end
|
169
205
|
|
@@ -199,21 +235,20 @@ describe 'boolean input' do
|
|
199
235
|
end
|
200
236
|
|
201
237
|
it 'should index the id of the wrapper' do
|
202
|
-
output_buffer.
|
238
|
+
expect(output_buffer).to have_tag("li#post_author_attributes_3_name_input")
|
203
239
|
end
|
204
240
|
|
205
241
|
it 'should index the id of the input tag' do
|
206
|
-
output_buffer.
|
242
|
+
expect(output_buffer).to have_tag("input#post_author_attributes_3_name")
|
207
243
|
end
|
208
244
|
|
209
245
|
it 'should index the name of the hidden input' do
|
210
|
-
output_buffer.
|
246
|
+
expect(output_buffer).to have_tag("input[@type='hidden'][@name='post[author_attributes][3][name]']")
|
211
247
|
end
|
212
248
|
|
213
249
|
it 'should index the name of the checkbox input' do
|
214
|
-
output_buffer.
|
250
|
+
expect(output_buffer).to have_tag("input[@type='checkbox'][@name='post[author_attributes][3][name]']")
|
215
251
|
end
|
216
252
|
|
217
253
|
end
|
218
|
-
|
219
254
|
end
|