formtastic 2.3.0 → 2.3.1
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 +8 -8
- data/lib/formtastic/inputs/boolean_input.rb +3 -1
- data/lib/formtastic/version.rb +1 -1
- data/spec/inputs/boolean_input_spec.rb +42 -28
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTFjYzY2MDMyNWE2NGI2YzNkMzJkNTVkNTQ0ZTg2N2QxYjg0OTgwMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZmE5MzZiNWU2YTUxNTEzYTgxYjhiZjhiOTkyYzY1MGRmZWE3NDZiMw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZTlhMTIxZTcxNWJhMTU5NmRkMzk2OGE2ZDBlYzQzOGZmNTQxZjE0ZTA4YTE2
|
10
|
+
OTFlMWMyYTNiYTBjZmZhMTFhMjRiOTI4ZWFkYzI1MzFhMzRhOGI5ZWIwYzhk
|
11
|
+
NzFlZmMwYTE3MDE2NmFmNjY1NTg2MDM4YmNhMDc1YTE4M2NlMTg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTYxODJlYjUxYWFmNDQyZDIyMjU2YjI2MWM3MzRhODEyOGY4MTE3YzliM2Q5
|
14
|
+
NmVlNGQ5ZTM4MDg2ZmQyMzc1MmVkZTYzMTVhMjFkNDEwNjE3YjEzYmUzYjY3
|
15
|
+
NDU1ZGZhYmRlNWZlYTcyNGE2N2RlZDMxOTY5YzMyN2QzM2VjZjE=
|
data/lib/formtastic/version.rb
CHANGED
@@ -8,18 +8,21 @@ describe 'boolean input' do
|
|
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
11
|
end
|
16
12
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
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
|
23
26
|
output_buffer.should_not have_tag('label.label')
|
24
27
|
output_buffer.should have_tag('form li label', :count => 1)
|
25
28
|
output_buffer.should have_tag('form li label[@for="post_allow_comments"]')
|
@@ -27,24 +30,25 @@ describe 'boolean input' do
|
|
27
30
|
output_buffer.should have_tag('form li label input[@type="checkbox"]', :count => 1)
|
28
31
|
output_buffer.should have_tag('form li input[@type="hidden"]', :count => 1)
|
29
32
|
output_buffer.should_not have_tag('form li label input[@type="hidden"]', :count => 1) # invalid HTML5
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should not add a "name" attribute to the label' do
|
36
|
+
output_buffer.should_not have_tag('form li label[@name]')
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should generate a checkbox input' do
|
40
|
+
output_buffer.should have_tag('form li label input')
|
41
|
+
output_buffer.should have_tag('form li label input#post_allow_comments')
|
42
|
+
output_buffer.should have_tag('form li label input[@type="checkbox"]')
|
43
|
+
output_buffer.should have_tag('form li label input[@name="post[allow_comments]"]')
|
44
|
+
output_buffer.should 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
|
+
output_buffer.should have_tag('form li label input[@checked="checked"]')
|
49
|
+
output_buffer.should have_tag('form li input[@name="post[allow_comments]"]', :count => 2)
|
50
|
+
output_buffer.should have_tag('form li input#post_allow_comments', :count => 1)
|
51
|
+
end
|
48
52
|
end
|
49
53
|
|
50
54
|
it 'should generate a checked input if :input_html is passed :checked => checked' do
|
@@ -127,6 +131,16 @@ describe 'boolean input' do
|
|
127
131
|
output_buffer.should have_tag('form li label input[@type="checkbox"][@value="yes"][@checked="checked"]')
|
128
132
|
end
|
129
133
|
|
134
|
+
it 'should generate a checked input for boolean database values compared to string checked values' do
|
135
|
+
@new_post.stub(: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
|
+
output_buffer.should have_tag('form li label input[@type="checkbox"][@value="1"][@checked="checked"]')
|
142
|
+
end
|
143
|
+
|
130
144
|
it 'should generate a checked input if object.method returns checked value when inverted' do
|
131
145
|
@new_post.stub(:allow_comments).and_return(0)
|
132
146
|
|
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: 2.3.
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin French
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|