Skip to content

Commit

Permalink
clarify assignments in generated view specs
Browse files Browse the repository at this point in the history
  • Loading branch information
dchelimsky committed Jun 19, 2010
1 parent 3def656 commit 0d244a1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/generators/rspec/scaffold/templates/edit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
describe "<%= table_name %>/edit.html.<%= options[:template_engine] %>" do
before(:each) do
assign(:<%= file_name %>, @<%= file_name %> = stub_model(<%= class_name %>,
@<%= file_name %> = assign(:<%= file_name %>, stub_model(<%= class_name %>,
:new_record? => false<%= output_attributes.empty? ? '' : ',' %>
<% output_attributes.each_with_index do |attribute, attribute_index| -%>
:<%= attribute.name %> => <%= attribute.default.inspect %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
Expand Down
4 changes: 2 additions & 2 deletions lib/generators/rspec/scaffold/templates/show_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
describe "<%= table_name %>/show.html.<%= options[:template_engine] %>" do
before(:each) do
assign(:<%= file_name %>, @<%= file_name %> = stub_model(<%= class_name %><%= output_attributes.empty? ? '))' : ',' %>
@<%= file_name %> = assign(:<%= file_name %>, stub_model(<%= class_name %><%= output_attributes.empty? ? '))' : ',' %>
<% output_attributes.each_with_index do |attribute, attribute_index| -%>
:<%= attribute.name %> => <%= attribute.default.inspect %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
<% end -%>
Expand All @@ -15,7 +15,7 @@
it "renders attributes in <p>" do
render
<% for attribute in output_attributes -%>
rendered.should contain(<%= attribute.default.inspect %>)
rendered.should contain(<%= attribute.default.inspect %>)
<% end -%>
end
end

0 comments on commit 0d244a1

Please sign in to comment.