Commit a039b3e0f1888c6b1f0e036fd820d018c50656ce
1 parent
fcd3a626
Exists in
master
and in
1 other branch
upgrading blitz
Showing
2 changed files
with
4 additions
and
4 deletions
Show diff stats
vendor/plugins/blitz/features/model_generator.feature
| @@ -22,8 +22,8 @@ Feature: Rails model generator | @@ -22,8 +22,8 @@ Feature: Rails model generator | ||
| 22 | And the blitz plugin is installed | 22 | And the blitz plugin is installed |
| 23 | When I generate a model "Post" that belongs to a "User" | 23 | When I generate a model "Post" that belongs to a "User" |
| 24 | Then a factory for "Post" should have an association to "User" | 24 | Then a factory for "Post" should have an association to "User" |
| 25 | - And the "Post" unit test should have "should_belong_to :user" macro | ||
| 26 | - And the "Post" unit test should have "should_have_db_index :user_id" macro | 25 | + And the "Post" unit test should have "should_belong_to :user" macro |
| 26 | + And the "Post" unit test should have "should_have_index :user_id" macro | ||
| 27 | And the "posts" table should have db index on "user_id" | 27 | And the "posts" table should have db index on "user_id" |
| 28 | And the "Post" model should have "belongs_to :user" macro | 28 | And the "Post" model should have "belongs_to :user" macro |
| 29 | 29 |
vendor/plugins/blitz/generators/model/templates/unit_test.rb
| @@ -6,8 +6,8 @@ class <%= class_name %>Test < ActiveSupport::TestCase | @@ -6,8 +6,8 @@ class <%= class_name %>Test < ActiveSupport::TestCase | ||
| 6 | end | 6 | end |
| 7 | <% attributes.each do |attribute| -%> | 7 | <% attributes.each do |attribute| -%> |
| 8 | <% if attribute.reference? -%> | 8 | <% if attribute.reference? -%> |
| 9 | - should_belong_to :<%= attribute.name %> | ||
| 10 | - should_have_db_index :<%= attribute.name %>_id | 9 | + should_belong_to :<%= attribute.name %> |
| 10 | + should_have_index :<%= attribute.name %>_id | ||
| 11 | <% end -%> | 11 | <% end -%> |
| 12 | <% if attribute.type == :paperclip -%> | 12 | <% if attribute.type == :paperclip -%> |
| 13 | should_have_attached_file :<%= attribute.name %> | 13 | should_have_attached_file :<%= attribute.name %> |