Skip to content

Commit 0d244a1

Browse files
committed
clarify assignments in generated view specs
1 parent 3def656 commit 0d244a1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/generators/rspec/scaffold/templates/edit_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
44
describe "<%= table_name %>/edit.html.<%= options[:template_engine] %>" do
55
before(:each) do
6-
assign(:<%= file_name %>, @<%= file_name %> = stub_model(<%= class_name %>,
6+
@<%= file_name %> = assign(:<%= file_name %>, stub_model(<%= class_name %>,
77
:new_record? => false<%= output_attributes.empty? ? '' : ',' %>
88
<% output_attributes.each_with_index do |attribute, attribute_index| -%>
99
:<%= attribute.name %> => <%= attribute.default.inspect %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>

lib/generators/rspec/scaffold/templates/show_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
44
describe "<%= table_name %>/show.html.<%= options[:template_engine] %>" do
55
before(:each) do
6-
assign(:<%= file_name %>, @<%= file_name %> = stub_model(<%= class_name %><%= output_attributes.empty? ? '))' : ',' %>
6+
@<%= file_name %> = assign(:<%= file_name %>, stub_model(<%= class_name %><%= output_attributes.empty? ? '))' : ',' %>
77
<% output_attributes.each_with_index do |attribute, attribute_index| -%>
88
:<%= attribute.name %> => <%= attribute.default.inspect %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
99
<% end -%>
@@ -15,7 +15,7 @@
1515
it "renders attributes in <p>" do
1616
render
1717
<% for attribute in output_attributes -%>
18-
rendered.should contain(<%= attribute.default.inspect %>)
18+
rendered.should contain(<%= attribute.default.inspect %>)
1919
<% end -%>
2020
end
2121
end

0 commit comments

Comments
 (0)