forme 2.2.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/spec/erb_helper.rb DELETED
@@ -1,198 +0,0 @@
1
- require_relative 'shared_erb_specs'
2
-
3
- ERB_BLOCK = lambda do |r|
4
- r.get '' do
5
- erb <<END
6
- <% form([:foo, :bar], :action=>'/baz') do |f| %>
7
- <p>FBB</p>
8
- <%= f.input(:first) %>
9
- <%= f.input(:last) %>
10
- <%= f.button('Save') %>
11
- <% end %>
12
- END
13
- end
14
-
15
- r.get 'inputs_block' do
16
- erb <<END
17
- <% form([:foo, :bar], :action=>'/baz') do |f| %><% f.inputs(:legend=>'FBB') do %>
18
- <%= f.input(:last) %>
19
- <% end %><% end %>
20
- END
21
- end
22
-
23
- r.get 'inputs_block_wrapper' do
24
- erb <<END
25
- <% form([:foo, :bar], {:action=>'/baz'}, :inputs_wrapper=>:fieldset_ol) do |f| %><% f.inputs(:legend=>'FBB') do %>
26
- <%= f.input(:last) %>
27
- <% end %><% end %>
28
- END
29
- end
30
-
31
- r.get 'nest' do
32
- erb <<END
33
- <% form([:foo, :bar], :action=>'/baz') do |f| %>
34
- <%= f.tag(:p, {}, 'FBB') %>
35
- <% f.tag(:div) do %>
36
- <%= f.input(:first) %>
37
- <%= f.input(:last) %>
38
- <% end %>
39
-
40
- <% end %>
41
- END
42
- end
43
-
44
- r.get 'nest_sep' do
45
- @nest = <<END
46
- n1
47
- <% f.tag(:div) do %>
48
- n2
49
- <%= f.input(:first) %>
50
- <%= f.input(:last) %>
51
- n3
52
- <% end %>
53
- n4
54
- <%= f.inputs([:first, :last], :legend=>'Foo') %>
55
- n5
56
- END
57
- erb <<END
58
- 0
59
- <% form([:foo, :bar], :action=>'/baz') do |f| %>
60
- 1
61
- <%= f.tag(:p, {}, 'FBB') %>
62
- 2
63
- <%= erb(@nest, :locals=>{:f=>f}) %>
64
- 3
65
- <% end %>
66
- 4
67
- END
68
- end
69
-
70
- r.get 'nest_seq_simple' do
71
- @album = Album.load(:name=>'N', :copies_sold=>2, :id=>1)
72
- @album.associations[:artist] = Artist.load(:name=>'A', :id=>2)
73
- @nest = <<END
74
- n1
75
- <% f.subform(:artist) do %>
76
- n2
77
- <%= f.input(:name2) %>
78
- n3
79
- <% end %>
80
- n4
81
- END
82
- erb <<END
83
- 0
84
- <% form(@album, :action=>'/baz') do |f| %>
85
- 1
86
- <%= erb(@nest, :locals=>{:f=>f}) %>
87
- 3
88
- <% end %>
89
- 4
90
- END
91
- end
92
-
93
- r.get 'nest_seq' do
94
- @album = Album.load(:name=>'N', :copies_sold=>2, :id=>1)
95
- @album.associations[:artist] = Artist.load(:name=>'A', :id=>2)
96
- @nest = <<END
97
- n1
98
- <% f.subform(:artist) do %>
99
- n2
100
- <%= f.input(:name2) %>
101
- n3
102
- <% end %>
103
- n4
104
- <%= f.subform(:artist, :inputs=>[:name3], :legend=>'Bar') %>
105
- n5
106
- END
107
- erb <<END
108
- 0
109
- <% form(@album, :action=>'/baz') do |f| %>
110
- 1
111
- <%= f.subform(:artist, :inputs=>[:name], :legend=>'Foo') %>
112
- 2
113
- <%= erb(@nest, :locals=>{:f=>f}) %>
114
- 3
115
- <% end %>
116
- 4
117
- END
118
- end
119
-
120
- r.get 'grid-block' do
121
- @album = Album.load(:name=>'N', :copies_sold=>2, :id=>1)
122
- @album.associations[:artist] = Artist.load(:name=>'A', :id=>2)
123
- erb <<END
124
- 0
125
- <% form(@album, {:action=>'/baz'}, :button=>'Sub') do |f| %>
126
- 1
127
- <% f.subform(:artist, :inputs=>[:name], :legend=>'Foo', :grid=>true, :labels=>%w'Name') do %>
128
- 2
129
- <% end %>
130
- 3
131
- <% end %>
132
- 4
133
- END
134
- end
135
-
136
- r.get 'grid-noblock' do
137
- @album = Album.load(:name=>'N', :copies_sold=>2, :id=>1)
138
- @album.associations[:artist] = Artist.load(:name=>'A', :id=>2)
139
- erb <<END
140
- 0
141
- <% form(@album, {:action=>'/baz'}, :button=>'Sub') do |f| %>
142
- 1
143
- <%= f.subform(:artist, :inputs=>[:name], :legend=>'Foo', :grid=>true, :labels=>%w'Name') %>
144
- 2
145
- <% end %>
146
- 3
147
- END
148
- end
149
-
150
- r.get 'grid-noblock-multiple' do
151
- @artist = Artist.load(:name=>'A', :id=>2)
152
- @artist.associations[:albums] = [Album.load(:name=>'N', :copies_sold=>2, :id=>1)]
153
- erb <<END
154
- 0
155
- <% form(@artist, {:action=>'/baz'}, :button=>'Sub') do |f| %>
156
- 1
157
- <%= f.subform(:albums, :inputs=>[:name, :copies_sold], :legend=>'Foo', :grid=>true, :labels=>%w'Name Copies') %>
158
- 2
159
- <% end %>
160
- 3
161
- END
162
- end
163
-
164
- r.get 'hash' do
165
- erb "<% form({:action=>'/baz'}, :obj=>[:foo]) do |f| %> <%= f.input(:first) %> <% end %>"
166
- end
167
-
168
- r.get 'legend' do
169
- erb <<END
170
- <% form([:foo, :bar], :action=>'/baz') do |f| %>
171
- <p>FBB</p>
172
- <%= f.inputs([:first, :last], :legend=>'Foo') %>
173
- <p>FBB2</p>
174
- <% end %>
175
- END
176
- end
177
-
178
- r.get 'combined' do
179
- erb <<END
180
- <% form([:foo, :bar], {:action=>'/baz'}, :inputs=>[:first], :button=>'xyz', :legend=>'123') do |f| %>
181
- <p>FBB</p>
182
- <%= f.input(:last) %>
183
- <% end %>
184
- END
185
- end
186
-
187
- r.get 'noblock' do
188
- erb "<%= form([:foo, :bar], {:action=>'/baz'}, :inputs=>[:first], :button=>'xyz', :legend=>'123') %>"
189
- end
190
-
191
- r.get 'noblock_post' do
192
- erb "<%= form({:method=>:post}, :button=>'xyz') %>"
193
- end
194
-
195
- r.get 'noblock_empty' do
196
- erb "<%= form(:action=>'/baz') %>"
197
- end
198
- end
@@ -1,198 +0,0 @@
1
- require_relative 'shared_erb_specs'
2
-
3
- ERUBI_CAPTURE_BLOCK = lambda do |r|
4
- r.get '' do
5
- erb <<END
6
- <%|= form([:foo, :bar], :action=>'/baz') do |f| %>
7
- <p>FBB</p>
8
- <%= f.input(:first) %>
9
- <%= f.input(:last) %>
10
- <%= f.button('Save') %>
11
- <%| end %>
12
- END
13
- end
14
-
15
- r.get 'inputs_block' do
16
- erb <<END
17
- <%|= form([:foo, :bar], :action=>'/baz') do |f| %><%|= f.inputs(:legend=>'FBB') do %>
18
- <%= f.input(:last) %>
19
- <%| end %><%| end %>
20
- END
21
- end
22
-
23
- r.get 'inputs_block_wrapper' do
24
- erb <<END
25
- <%|= form([:foo, :bar], {:action=>'/baz'}, :inputs_wrapper=>:fieldset_ol) do |f| %><%|= f.inputs(:legend=>'FBB') do %>
26
- <%= f.input(:last) %>
27
- <%| end %><%| end %>
28
- END
29
- end
30
-
31
- r.get 'nest' do
32
- erb <<END
33
- <%|= form([:foo, :bar], :action=>'/baz') do |f| %>
34
- <%= f.tag(:p, {}, 'FBB') %>
35
- <%|= f.tag(:div) do %>
36
- <%= f.input(:first) %>
37
- <%= f.input(:last) %>
38
- <%| end %>
39
-
40
- <%| end %>
41
- END
42
- end
43
-
44
- r.get 'nest_sep' do
45
- @nest = <<END
46
- n1
47
- <%|= f.tag(:div) do %>
48
- n2
49
- <%= f.input(:first) %>
50
- <%= f.input(:last) %>
51
- n3
52
- <%| end %>
53
- n4
54
- <%= f.inputs([:first, :last], :legend=>'Foo') %>
55
- n5
56
- END
57
- erb <<END
58
- 0
59
- <%|= form([:foo, :bar], :action=>'/baz') do |f| %>
60
- 1
61
- <%= f.tag(:p, {}, 'FBB') %>
62
- 2
63
- <%= erb(@nest, :locals=>{:f=>f}) %>
64
- 3
65
- <%| end %>
66
- 4
67
- END
68
- end
69
-
70
- r.get 'nest_seq_simple' do
71
- @album = Album.load(:name=>'N', :copies_sold=>2, :id=>1)
72
- @album.associations[:artist] = Artist.load(:name=>'A', :id=>2)
73
- @nest = <<END
74
- n1
75
- <%|= f.subform(:artist) do %>
76
- n2
77
- <%= f.input(:name2) %>
78
- n3
79
- <%| end %>
80
- n4
81
- END
82
- erb <<END
83
- 0
84
- <%|= form(@album, :action=>'/baz') do |f| %>
85
- 1
86
- <%= erb(@nest, :locals=>{:f=>f}) %>
87
- 3
88
- <%| end %>
89
- 4
90
- END
91
- end
92
-
93
- r.get 'nest_seq' do
94
- @album = Album.load(:name=>'N', :copies_sold=>2, :id=>1)
95
- @album.associations[:artist] = Artist.load(:name=>'A', :id=>2)
96
- @nest = <<END
97
- n1
98
- <%|= f.subform(:artist) do %>
99
- n2
100
- <%= f.input(:name2) %>
101
- n3
102
- <%| end %>
103
- n4
104
- <%= f.subform(:artist, :inputs=>[:name3], :legend=>'Bar') %>
105
- n5
106
- END
107
- erb <<END
108
- 0
109
- <%|= form(@album, :action=>'/baz') do |f| %>
110
- 1
111
- <%= f.subform(:artist, :inputs=>[:name], :legend=>'Foo') %>
112
- 2
113
- <%= erb(@nest, :locals=>{:f=>f}) %>
114
- 3
115
- <%| end %>
116
- 4
117
- END
118
- end
119
-
120
- r.get 'grid-block' do
121
- @album = Album.load(:name=>'N', :copies_sold=>2, :id=>1)
122
- @album.associations[:artist] = Artist.load(:name=>'A', :id=>2)
123
- erb <<END
124
- 0
125
- <%|= form(@album, {:action=>'/baz'}, :button=>'Sub') do |f| %>
126
- 1
127
- <%|= f.subform(:artist, :inputs=>[:name], :legend=>'Foo', :grid=>true, :labels=>%w'Name') do %>
128
- 2
129
- <%| end %>
130
- 3
131
- <%| end %>
132
- 4
133
- END
134
- end
135
-
136
- r.get 'grid-noblock' do
137
- @album = Album.load(:name=>'N', :copies_sold=>2, :id=>1)
138
- @album.associations[:artist] = Artist.load(:name=>'A', :id=>2)
139
- erb <<END
140
- 0
141
- <%|= form(@album, {:action=>'/baz'}, :button=>'Sub') do |f| %>
142
- 1
143
- <%= f.subform(:artist, :inputs=>[:name], :legend=>'Foo', :grid=>true, :labels=>%w'Name') %>
144
- 2
145
- <%| end %>
146
- 3
147
- END
148
- end
149
-
150
- r.get 'grid-noblock-multiple' do
151
- @artist = Artist.load(:name=>'A', :id=>2)
152
- @artist.associations[:albums] = [Album.load(:name=>'N', :copies_sold=>2, :id=>1)]
153
- erb <<END
154
- 0
155
- <%|= form(@artist, {:action=>'/baz'}, :button=>'Sub') do |f| %>
156
- 1
157
- <%= f.subform(:albums, :inputs=>[:name, :copies_sold], :legend=>'Foo', :grid=>true, :labels=>%w'Name Copies') %>
158
- 2
159
- <%| end %>
160
- 3
161
- END
162
- end
163
-
164
- r.get 'hash' do
165
- erb "<%|= form({:action=>'/baz'}, :obj=>[:foo]) do |f| %> <%= f.input(:first) %> <%| end %>"
166
- end
167
-
168
- r.get 'legend' do
169
- erb <<END
170
- <%|= form([:foo, :bar], :action=>'/baz') do |f| %>
171
- <p>FBB</p>
172
- <%= f.inputs([:first, :last], :legend=>'Foo') %>
173
- <p>FBB2</p>
174
- <%| end %>
175
- END
176
- end
177
-
178
- r.get 'combined' do
179
- erb <<END
180
- <%|= form([:foo, :bar], {:action=>'/baz'}, :inputs=>[:first], :button=>'xyz', :legend=>'123') do |f| %>
181
- <p>FBB</p>
182
- <%= f.input(:last) %>
183
- <%| end %>
184
- END
185
- end
186
-
187
- r.get 'noblock' do
188
- erb "<%= form([:foo, :bar], {:action=>'/baz'}, :inputs=>[:first], :button=>'xyz', :legend=>'123') %>"
189
- end
190
-
191
- r.get 'noblock_post' do
192
- erb "<%= form({:method=>:post}, :button=>'xyz') %>"
193
- end
194
-
195
- r.get 'noblock_empty' do
196
- erb "<%= form(:action=>'/baz') %>"
197
- end
198
- end
@@ -1,14 +0,0 @@
1
- require 'coverage'
2
- require 'simplecov'
3
-
4
- def SimpleCov.forme_coverage(opts = {})
5
- start do
6
- enable_coverage :branch
7
- add_filter "/spec/"
8
- add_group('Missing'){|src| src.covered_percent < 100}
9
- add_group('Covered'){|src| src.covered_percent == 100}
10
- yield self if block_given?
11
- end
12
- end
13
-
14
- ENV.delete('COVERAGE')