Permalink
Browse files

Make sure that no extra spaces are created with a non-polymorphic

attributes
  • Loading branch information...
1 parent d668544 commit 8dac9768b16c6cfaffa6c84abaaa7c4926020e0b @rafaelfranca rafaelfranca committed Dec 11, 2012
@@ -4,13 +4,17 @@
one:
<% attributes.each do |attribute| -%>
<%= attribute.column_name %>: <%= attribute.default %>
- <%= "#{attribute.name}_type: #{attribute.human_name}" if attribute.polymorphic? %>
+ <%- if attribute.polymorphic? -%>
+ <%= "#{attribute.name}_type: #{attribute.human_name}" %>
+ <%- end -%>
<% end -%>
two:
<% attributes.each do |attribute| -%>
<%= attribute.column_name %>: <%= attribute.default %>
- <%= "#{attribute.name}_type: #{attribute.human_name}" if attribute.polymorphic? %>
+ <%- if attribute.polymorphic? -%>
+ <%= "#{attribute.name}_type: #{attribute.human_name}" %>
+ <%- end -%>
<% end -%>
<% else -%>
# This model initially had no columns defined. If you add columns to the
@@ -275,12 +275,12 @@ def test_invokes_default_test_framework
def test_fixtures_use_the_references_ids
run_generator ["LineItem", "product:references", "cart:belongs_to"]
- assert_file "test/fixtures/line_items.yml", /product_id: /, /cart_id: /
+ assert_file "test/fixtures/line_items.yml", /product_id: \n cart_id: /
end
def test_fixtures_use_the_references_ids_and_type
run_generator ["LineItem", "product:references{polymorphic}", "cart:belongs_to"]
- assert_file "test/fixtures/line_items.yml", /product_id: /, /product_type: Product/, /cart_id: /
+ assert_file "test/fixtures/line_items.yml", /product_id: \n product_type: Product\n cart_id: /
end
def test_fixture_is_skipped

0 comments on commit 8dac976

Please sign in to comment.