authorized_rails_scaffolds 0.0.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.
Files changed (24) hide show
  1. data/.gitignore +19 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE.txt +22 -0
  4. data/README.md +101 -0
  5. data/Rakefile +1 -0
  6. data/authorized_rails_scaffolds.gemspec +24 -0
  7. data/lib/authorized_rails_scaffolds.rb +5 -0
  8. data/lib/authorized_rails_scaffolds/version.rb +3 -0
  9. data/lib/generators/authorized_rails_scaffolds/install_scaffold/USAGE +9 -0
  10. data/lib/generators/authorized_rails_scaffolds/install_scaffold/install_scaffold_generator.rb +26 -0
  11. data/lib/generators/authorized_rails_scaffolds/install_scaffold/templates/_form.html.erb +18 -0
  12. data/lib/generators/authorized_rails_scaffolds/install_scaffold/templates/controller.rb +107 -0
  13. data/lib/generators/authorized_rails_scaffolds/install_scaffold/templates/edit.html.erb +5 -0
  14. data/lib/generators/authorized_rails_scaffolds/install_scaffold/templates/index.html.erb +52 -0
  15. data/lib/generators/authorized_rails_scaffolds/install_scaffold/templates/new.html.erb +5 -0
  16. data/lib/generators/authorized_rails_scaffolds/install_scaffold/templates/show.html.erb +34 -0
  17. data/lib/generators/authorized_rails_scaffolds/install_spec/USAGE +9 -0
  18. data/lib/generators/authorized_rails_scaffolds/install_spec/install_spec_generator.rb +18 -0
  19. data/lib/generators/authorized_rails_scaffolds/install_spec/templates/controller_spec.rb +358 -0
  20. data/lib/generators/authorized_rails_scaffolds/install_spec/templates/edit_spec.rb +99 -0
  21. data/lib/generators/authorized_rails_scaffolds/install_spec/templates/index_spec.rb +185 -0
  22. data/lib/generators/authorized_rails_scaffolds/install_spec/templates/new_spec.rb +98 -0
  23. data/lib/generators/authorized_rails_scaffolds/install_spec/templates/show_spec.rb +64 -0
  24. metadata +103 -0
@@ -0,0 +1,9 @@
1
+ Description:
2
+ Installs rspec templates that offer better coverage than the default rspec templates
3
+
4
+ Example:
5
+ rails generate authorized_rails_scaffolds:install_spec
6
+
7
+ This will create:
8
+ RSpec controller and view spec templates in lib/rspec/scaffold
9
+
@@ -0,0 +1,18 @@
1
+ class AuthorizedRailsScaffolds::InstallSpecGenerator < Rails::Generators::NamedBase
2
+ source_root File.expand_path('../templates', __FILE__)
3
+
4
+ def create_rspec_templates
5
+ copy_rspec_template 'controller_spec.rb'
6
+ copy_rspec_template 'edit_spec.rb'
7
+ copy_rspec_template 'index_spec.rb'
8
+ copy_rspec_template 'new_spec.rb'
9
+ copy_rspec_template 'show_spec.rb'
10
+ end
11
+
12
+ protected
13
+
14
+ def copy_rspec_template(template_name)
15
+ copy_file template_name, "lib/templates/rspec/scaffold/#{template_name}"
16
+ end
17
+
18
+ end
@@ -0,0 +1,358 @@
1
+ require 'spec_helper'
2
+
3
+ # This spec was generated by rspec-rails when you ran the scaffold generator.
4
+ # It demonstrates how one might use RSpec to specify the controller code that
5
+ # was generated by Rails when you ran the scaffold generator.
6
+ #
7
+ # It assumes that the implementation code is generated by the rails scaffold
8
+ # generator. If you are using any extension libraries to generate different
9
+ # controller code, this generated spec may or may not pass.
10
+ #
11
+ # It only uses APIs available in rails and/or rspec-rails. There are a number
12
+ # of tools you can use to make these specs even more expressive, but we're
13
+ # sticking to rails and rspec-rails APIs to keep things simple and stable.
14
+ #
15
+ # Compared to earlier versions of this generator, there is very limited use of
16
+ # stubs and message expectations in this spec. Stubs are only used when there
17
+ # is no simpler way to get a handle on the object needed for the example.
18
+ # Message expectations are only used when there is no simpler way to specify
19
+ # that an instance is receiving a specific message.
20
+
21
+ <% module_namespacing do -%>
22
+ <%- local_class_name = class_name.split("::")[-1] -%>
23
+ describe <%= controller_class_name %>Controller do
24
+
25
+ # This should return the minimal set of attributes required to create a valid
26
+ # <%= local_class_name %>.
27
+ def valid_create_attributes
28
+ FactoryGirl.attributes_for(:<%= file_name %>)
29
+ end
30
+
31
+ # This should return the minimal set of attributes required to update a valid
32
+ # <%= local_class_name %>.
33
+ def valid_update_attributes
34
+ FactoryGirl.attributes_for(:<%= file_name %>)
35
+ end
36
+
37
+ <% unless options[:singleton] -%>
38
+ describe "GET index" do
39
+ context 'without a user' do
40
+ describe 'with valid request' do
41
+ before(:each) do
42
+ @<%= file_name %> = FactoryGirl.create(:<%= file_name %>)
43
+ get :index, {}
44
+ end
45
+ it { should redirect_to(new_user_session_path) }
46
+ it { should set_the_flash[:alert].to("You need to sign in or sign up before continuing.") }
47
+ end
48
+ end
49
+ context 'as an unauthorized user' do
50
+ login_unauthorized_user
51
+ describe 'with valid request' do
52
+ before(:each) do
53
+ @<%= file_name %> = FactoryGirl.create(:<%= file_name %>)
54
+ get :index, {}
55
+ end
56
+ it { should redirect_to(root_url) }
57
+ it { should set_the_flash[:alert].to("You are not authorized to access this page.") }
58
+ end
59
+ end
60
+ context 'as user with read ability' do
61
+ login_user_with_ability :read, <%= local_class_name %>
62
+ describe 'with valid request' do
63
+ before(:each) do
64
+ @<%= file_name %> = FactoryGirl.create(:<%= file_name %>)
65
+ get :index, {}
66
+ end
67
+ it { should respond_with(:success) }
68
+ it { should render_template(:index) }
69
+ it { should render_with_layout(:application) }
70
+ it "assigns all <%= file_name.pluralize %> as @<%= file_name.pluralize %>" do
71
+ assigns(:<%= file_name.pluralize %>).should eq([@<%= file_name %>])
72
+ end
73
+ end
74
+ end
75
+ end
76
+
77
+ <% end -%>
78
+ describe "GET show" do
79
+ context 'without a user' do
80
+ describe 'with valid request' do
81
+ before(:each) do
82
+ @<%= file_name %> = FactoryGirl.create(:<%= file_name %>)
83
+ get :show, {:id => @<%= file_name %>.to_param}
84
+ end
85
+ it { should redirect_to(new_user_session_path) }
86
+ it { should set_the_flash[:alert].to("You need to sign in or sign up before continuing.") }
87
+ end
88
+ end
89
+ context 'as an unauthorized user' do
90
+ login_unauthorized_user
91
+ describe 'with valid request' do
92
+ before(:each) do
93
+ @<%= file_name %> = FactoryGirl.create(:<%= file_name %>)
94
+ get :show, {:id => @<%= file_name %>.to_param}
95
+ end
96
+ it { should redirect_to(<%= index_helper %>_path) }
97
+ it { should set_the_flash[:alert].to("You are not authorized to access this page.") }
98
+ end
99
+ end
100
+ context 'as user with read ability' do
101
+ login_user_with_ability :read, <%= local_class_name %>
102
+ describe 'with valid request' do
103
+ before(:each) do
104
+ @<%= file_name %> = FactoryGirl.create(:<%= file_name %>)
105
+ get :show, {:id => @<%= file_name %>.to_param}
106
+ end
107
+ it { should respond_with(:success) }
108
+ it { should render_template(:show) }
109
+ it { should render_with_layout(:application) }
110
+ it "assigns the requested <%= file_name %> as @<%= file_name %>" do
111
+ assigns(:<%= file_name %>).should eq(@<%= file_name %>)
112
+ end
113
+ end
114
+ end
115
+ end
116
+
117
+ describe "GET new" do
118
+ context 'without a user' do
119
+ describe 'with valid request' do
120
+ before(:each) do
121
+ get :new, {}
122
+ end
123
+ it { should redirect_to(new_user_session_path) }
124
+ it { should set_the_flash[:alert].to("You need to sign in or sign up before continuing.") }
125
+ end
126
+ end
127
+ context 'as an unauthorized user' do
128
+ login_unauthorized_user
129
+ describe 'with valid request' do
130
+ before(:each) do
131
+ get :new, {}
132
+ end
133
+ it { should redirect_to(<%= index_helper %>_url) }
134
+ it { should set_the_flash[:alert].to("You are not authorized to access this page.") }
135
+ end
136
+ end
137
+ context 'as user with create ability' do
138
+ login_user_with_ability :create, <%= local_class_name %>
139
+ describe 'with valid request' do
140
+ before(:each) do
141
+ get :new, {}
142
+ end
143
+ it { should respond_with(:success) }
144
+ it { should render_template(:new) }
145
+ it { should render_with_layout(:application) }
146
+ it "assigns a new <%= file_name %> as @<%= file_name %>" do
147
+ assigns(:<%= file_name %>).should be_a_new(<%= local_class_name %>)
148
+ end
149
+ end
150
+ end
151
+ end
152
+
153
+ describe "GET edit" do
154
+ context 'without a user' do
155
+ describe 'with valid request' do
156
+ before(:each) do
157
+ @<%= file_name %> = FactoryGirl.create(:<%= file_name %>)
158
+ get :edit, {:id => @<%= file_name %>.to_param}
159
+ end
160
+ it { should redirect_to(new_user_session_path) }
161
+ it { should set_the_flash[:alert].to("You need to sign in or sign up before continuing.") }
162
+ end
163
+ end
164
+ context 'as an unauthorized user' do
165
+ login_unauthorized_user
166
+ describe 'with valid request' do
167
+ before(:each) do
168
+ @<%= file_name %> = FactoryGirl.create(:<%= file_name %>)
169
+ get :edit, {:id => @<%= file_name %>.to_param}
170
+ end
171
+ it { should redirect_to(<%= index_helper %>_url) }
172
+ it { should set_the_flash[:alert].to("You are not authorized to access this page.") }
173
+ end
174
+ end
175
+ context 'as user with update ability' do
176
+ login_user_with_ability :update, <%= local_class_name %>
177
+ describe 'with valid request' do
178
+ before(:each) do
179
+ @<%= file_name %> = FactoryGirl.create(:<%= file_name %>)
180
+ get :edit, {:id => @<%= file_name %>.to_param}
181
+ end
182
+ it { should respond_with(:success) }
183
+ it { should render_template(:edit) }
184
+ it { should render_with_layout(:application) }
185
+ it "assigns the requested <%= file_name %> as @<%= file_name %>" do
186
+ assigns(:<%= file_name %>).should eq(@<%= file_name %>)
187
+ end
188
+ end
189
+ end
190
+ end
191
+
192
+ describe "POST create" do
193
+ context 'without a user' do
194
+ describe 'with valid params' do
195
+ before(:each) do
196
+ post :create, {:<%= file_name %> => valid_create_attributes}
197
+ end
198
+ it { should redirect_to(new_user_session_path) }
199
+ it { should set_the_flash[:alert].to("You need to sign in or sign up before continuing.") }
200
+ end
201
+ end
202
+ context 'as an unauthorized user' do
203
+ login_unauthorized_user
204
+ describe "with valid params" do
205
+ before(:each) do
206
+ post :create, {:<%= file_name %> => valid_create_attributes}
207
+ end
208
+ it { should redirect_to(<%= index_helper %>_url) }
209
+ it { should set_the_flash[:alert].to("You are not authorized to access this page.") }
210
+ end
211
+ end
212
+ context 'as user with create ability' do
213
+ login_user_with_ability :create, <%= local_class_name %>
214
+ describe "with valid params" do
215
+ it "creates a new <%= local_class_name %>" do
216
+ expect {
217
+ post :create, {:<%= file_name %> => valid_create_attributes}
218
+ }.to change(<%= local_class_name %>, :count).by(1)
219
+ end
220
+ end
221
+ describe 'with valid params' do
222
+ before(:each) do
223
+ post :create, {:<%= file_name %> => valid_create_attributes}
224
+ end
225
+ it "assigns a newly created <%= file_name %> as @<%= file_name %>" do
226
+ assigns(:<%= file_name %>).should be_a(<%= local_class_name %>)
227
+ assigns(:<%= file_name %>).should be_persisted
228
+ end
229
+ it "redirects to the created <%= file_name %>" do
230
+ response.should redirect_to(<%= ns_file_name %>_path(<%= local_class_name %>.last))
231
+ end
232
+ end
233
+ describe "with invalid params" do
234
+ before(:each) do
235
+ # Trigger the behavior that occurs when invalid params are submitted
236
+ <%= local_class_name %>.any_instance.stub(:save).and_return(false)
237
+ post :create, {:<%= file_name %> => <%= formatted_hash(example_invalid_attributes) %>}
238
+ end
239
+ it { should render_template(:new) }
240
+ it { should render_with_layout(:application) }
241
+ it "assigns a newly created but unsaved <%= file_name %> as @<%= file_name %>" do
242
+ assigns(:<%= file_name %>).should be_a_new(<%= local_class_name %>)
243
+ end
244
+ end
245
+ end
246
+ end
247
+
248
+ describe "PUT update" do
249
+ context 'without a user' do
250
+ describe 'with valid params' do
251
+ before(:each) do
252
+ @<%= file_name %> = FactoryGirl.create(:<%= file_name %>)
253
+ put :update, {:id => @<%= file_name %>.to_param, :<%= file_name %> => valid_update_attributes}
254
+ end
255
+ it { should redirect_to(new_user_session_path) }
256
+ it { should set_the_flash[:alert].to("You need to sign in or sign up before continuing.") }
257
+ end
258
+ end
259
+ context 'as an unauthorized user' do
260
+ login_unauthorized_user
261
+ describe "with valid params" do
262
+ before(:each) do
263
+ @<%= file_name %> = FactoryGirl.create(:<%= file_name %>)
264
+ put :update, {:id => @<%= file_name %>.to_param, :<%= file_name %> => valid_update_attributes}
265
+ end
266
+ it { should redirect_to(<%= index_helper %>_url) }
267
+ it { should set_the_flash[:alert].to("You are not authorized to access this page.") }
268
+ end
269
+ end
270
+ context 'as user with update ability' do
271
+ login_user_with_ability :update, <%= local_class_name %>
272
+ describe "with valid params" do
273
+ it "updates the requested <%= file_name %>" do
274
+ @<%= file_name %> = FactoryGirl.create(:<%= file_name %>)
275
+ # Assuming there are no other <%= file_name %> in the database, this
276
+ # specifies that the <%= local_class_name %> created on the previous line
277
+ # receives the :update_attributes message with whatever params are
278
+ # submitted in the request.
279
+ <%- if Rails.version >= '4' -%>
280
+ <%= local_class_name %>.any_instance.should_receive(:update).with(<%= formatted_hash(example_params_for_update) %>)
281
+ <%- else -%>
282
+ <%= local_class_name %>.any_instance.should_receive(:update_attributes).with(<%= formatted_hash(example_params_for_update) %>)
283
+ <%- end -%>
284
+ put :update, {:id => @<%= file_name %>.to_param, :<%= file_name %> => <%= formatted_hash(example_params_for_update) %>}
285
+ end
286
+ end
287
+ describe "with valid params" do
288
+ before(:each) do
289
+ @<%= file_name %> = FactoryGirl.create(:<%= file_name %>)
290
+ put :update, {:id => @<%= file_name %>.to_param, :<%= file_name %> => valid_update_attributes}
291
+ end
292
+ it "assigns the requested <%= file_name %> as @<%= file_name %>" do
293
+ assigns(:<%= file_name %>).should eq(@<%= file_name %>)
294
+ end
295
+ it "redirects to the <%= file_name %>" do
296
+ response.should redirect_to(<%= ns_file_name %>_path(@<%= file_name %>))
297
+ end
298
+ end
299
+ describe "with invalid params" do
300
+ before(:each) do
301
+ @<%= file_name %> = FactoryGirl.create(:<%= file_name %>)
302
+ # Trigger the behavior that occurs when invalid params are submitted
303
+ <%= local_class_name %>.any_instance.stub(:save).and_return(false)
304
+ put :update, {:id => @<%= file_name %>.to_param, :<%= file_name %> => <%= formatted_hash(example_invalid_attributes) %>}
305
+ end
306
+ it { should render_template(:edit) }
307
+ it { should render_with_layout(:application) }
308
+ it "assigns the <%= file_name %> as @<%= file_name %>" do
309
+ assigns(:<%= file_name %>).should eq(@<%= file_name %>)
310
+ end
311
+ end
312
+ end
313
+ end
314
+
315
+ describe "DELETE destroy" do
316
+ context 'without a user' do
317
+ describe 'with valid request' do
318
+ before(:each) do
319
+ @<%= file_name %> = FactoryGirl.create(:<%= file_name %>)
320
+ delete :destroy, {:id => @<%= file_name %>.to_param}
321
+ end
322
+ it { should redirect_to(new_user_session_path) }
323
+ it { should set_the_flash[:alert].to("You need to sign in or sign up before continuing.") }
324
+ end
325
+ end
326
+ context 'as an unauthorized user' do
327
+ login_unauthorized_user
328
+ describe "with valid request" do
329
+ before(:each) do
330
+ @<%= file_name %> = FactoryGirl.create(:<%= file_name %>)
331
+ delete :destroy, {:id => @<%= file_name %>.to_param}
332
+ end
333
+ it { should redirect_to(<%= index_helper %>_url) }
334
+ it { should set_the_flash[:alert].to("You are not authorized to access this page.") }
335
+ end
336
+ end
337
+ context 'as user with destroy ability' do
338
+ login_user_with_ability :destroy, <%= local_class_name %>
339
+ it "destroys the requested <%= file_name %>" do
340
+ @<%= file_name %> = FactoryGirl.create(:<%= file_name %>)
341
+ expect {
342
+ delete :destroy, {:id => @<%= file_name %>.to_param}
343
+ }.to change(<%= local_class_name %>, :count).by(-1)
344
+ end
345
+ describe 'with valid request' do
346
+ before(:each) do
347
+ @<%= file_name %> = FactoryGirl.create(:<%= file_name %>)
348
+ delete :destroy, {:id => @<%= file_name %>.to_param}
349
+ end
350
+ it "redirects to the <%= file_name %> list" do
351
+ response.should redirect_to(<%= index_helper %>_url)
352
+ end
353
+ end
354
+ end
355
+ end
356
+
357
+ end
358
+ <% end -%>
@@ -0,0 +1,99 @@
1
+ require 'spec_helper'
2
+
3
+ <% local_class_name = class_name.split('::')[-1] -%>
4
+ <% output_attributes = attributes.reject{|attribute| [:timestamp].index(attribute.type) } -%>
5
+ <% standard_attributes = output_attributes.reject{|attribute| [:time, :date, :datetime].index(attribute.type) } -%>
6
+ <% date_attributes = output_attributes.reject{|attribute| ![:time, :date, :datetime].index(attribute.type) } -%>
7
+ describe "<%= ns_table_name %>/edit" do
8
+ before(:each) do
9
+ @<%= file_name %> = assign(:<%= file_name %>, FactoryGirl.build_stubbed(:<%= file_name %><%= output_attributes.empty? ? '))' : ',' %>
10
+ <% output_attributes.each_with_index do |attribute, attribute_index| -%>
11
+ <%-
12
+ attribute_prefix = ''
13
+ attribute_suffix = ')'
14
+ if attribute.type == :datetime
15
+ attribute_value = value_for(attribute)
16
+ attribute_prefix = 'DateTime.parse('
17
+ elsif attribute.type == :time
18
+ attribute_value = value_for(attribute).to_time.strftime('%T').dump
19
+ attribute_prefix = 'Time.parse('
20
+ elsif attribute.type == :date
21
+ attribute_value = value_for(attribute)
22
+ attribute_prefix = 'Date.parse('
23
+ else
24
+ attribute_value = value_for(attribute)
25
+ attribute_suffix = ''
26
+ end
27
+ -%>
28
+ :<%= attribute.name %> => <%= attribute_prefix %><%= attribute_value %><%= attribute_suffix %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
29
+ <% end -%>
30
+ <%= output_attributes.empty? ? "" : " ))\n" -%>
31
+ end
32
+
33
+ it "renders the edit <%= file_name %> form" do
34
+ render
35
+
36
+ <% if webrat? -%>
37
+ rendered.should have_selector("form", :action => <%= ns_file_name %>_path(@<%= file_name %>), :method => "post") do |form|
38
+ <% for attribute in standard_attributes -%>
39
+ form.should have_selector("<%= attribute.input_type -%>#<%= file_name %>_<%= attribute.name %>", :name => "<%= file_name %>[<%= attribute.name %>]")
40
+ <% end -%>
41
+ end
42
+ <% else -%>
43
+ # Run the generator again with the --webrat flag if you want to use webrat matchers
44
+ assert_select "form[action=?][method=?]", <%= ns_file_name %>_path(@<%= file_name %>), "post" do
45
+ <% for attribute in standard_attributes -%>
46
+ assert_select "<%= attribute.input_type -%>#<%= file_name %>_<%= attribute.name %>[name=?]", "<%= file_name %>[<%= attribute.name %>]"
47
+ <% end -%>
48
+ end
49
+ <% end -%>
50
+ end
51
+
52
+ <% if date_attributes.any? -%>
53
+ it "renders all date/time form elements" do
54
+ render
55
+
56
+ <% if webrat? -%>
57
+ rendered.should have_selector("form", :action => <%= ns_file_name %>_path(@<%= file_name %>), :method => "post") do |form|
58
+ <% for attribute in date_attributes -%>
59
+ <%- if [:date, :datetime].include? attribute.type -%>
60
+ form.should have_selector("select#<%= file_name %>_<%= attribute.name %>", :name => "<%= file_name %>[<%= attribute.name %>]")
61
+ form.should have_selector("select#<%= file_name %>_<%= attribute.name %>", :name => "<%= file_name %>[<%= attribute.name %>]")
62
+ form.should have_selector("select#<%= file_name %>_<%= attribute.name %>", :name => "<%= file_name %>[<%= attribute.name %>]")
63
+ <%- end -%>
64
+ <%- if [:time, :datetime].include? attribute.type -%>
65
+ form.should have_selector("select#<%= file_name %>_<%= attribute.name %>", :name => "<%= file_name %>[<%= attribute.name %>]")
66
+ form.should have_selector("select#<%= file_name %>_<%= attribute.name %>", :name => "<%= file_name %>[<%= attribute.name %>]")
67
+ <%- end -%>
68
+ <% end -%>
69
+ end
70
+ <% else -%>
71
+ # Run the generator again with the --webrat flag if you want to use webrat matchers
72
+ assert_select "form[action=?][method=?]", <%= ns_file_name %>_path(@<%= file_name %>), "post" do
73
+ <% for attribute in date_attributes -%>
74
+ <%- if [:date, :datetime].include? attribute.type -%>
75
+ assert_select "select#<%= file_name %>_<%= attribute.name %>_1i[name=?]", "<%= file_name %>[<%= attribute.name %>(1i)]" do
76
+ assert_select "option[selected=selected]", :text => <%= DateTime.parse(attribute.default).strftime('%Y').dump %>, :count => 1
77
+ end
78
+ assert_select "select#<%= file_name %>_<%= attribute.name %>_2i[name=?]", "<%= file_name %>[<%= attribute.name %>(2i)]" do
79
+ assert_select "option[selected=selected][value=?]", <%= DateTime.parse(attribute.default).strftime('%-m').dump %>, :text => <%= DateTime.parse(attribute.default).strftime('%B').dump %>, :count => 1
80
+ end
81
+ assert_select "select#<%= file_name %>_<%= attribute.name %>_3i[name=?]", "<%= file_name %>[<%= attribute.name %>(3i)]" do
82
+ assert_select "option[selected=selected]", :text => <%= DateTime.parse(attribute.default).strftime('%d').dump %>, :count => 1
83
+ end
84
+ <%- end -%>
85
+ <%- if [:time, :datetime].include? attribute.type -%>
86
+ assert_select "select#<%= file_name %>_<%= attribute.name %>_4i[name=?]", "<%= file_name %>[<%= attribute.name %>(4i)]" do
87
+ assert_select "option[selected=selected]", :text => <%= DateTime.parse(attribute.default).strftime('%H').dump %>, :count => 1
88
+ end
89
+ assert_select "select#<%= file_name %>_<%= attribute.name %>_5i[name=?]", "<%= file_name %>[<%= attribute.name %>(5i)]" do
90
+ assert_select "option[selected=selected]", :text => <%= DateTime.parse(attribute.default).strftime('%M').dump %>, :count => 1
91
+ end
92
+ <%- end -%>
93
+ <% end -%>
94
+ end
95
+ <% end -%>
96
+ end
97
+
98
+ <% end -%>
99
+ end