aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/generators
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2010-12-16 20:10:30 -0200
committerSantiago Pastorino <santiago@wyeworks.com>2010-12-16 20:58:58 -0200
commit3b9120fa52b76fb8591fe1d0db85d1a940e867d0 (patch)
tree9f7a66f9bd99a31a5b69f2c06b2ff0231d02b4b0 /railties/test/generators
parentf176b2552ecc06634dae53b82a4562d8e80aeed6 (diff)
downloadrails-3b9120fa52b76fb8591fe1d0db85d1a940e867d0.tar.gz
rails-3b9120fa52b76fb8591fe1d0db85d1a940e867d0.tar.bz2
rails-3b9120fa52b76fb8591fe1d0db85d1a940e867d0.zip
Generate add_index by default when giving type belongs_to or references
Diffstat (limited to 'railties/test/generators')
-rw-r--r--railties/test/generators/scaffold_generator_test.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/railties/test/generators/scaffold_generator_test.rb b/railties/test/generators/scaffold_generator_test.rb
index f366600b16..df787f61ba 100644
--- a/railties/test/generators/scaffold_generator_test.rb
+++ b/railties/test/generators/scaffold_generator_test.rb
@@ -3,7 +3,7 @@ require 'rails/generators/rails/scaffold/scaffold_generator'
class ScaffoldGeneratorTest < Rails::Generators::TestCase
include GeneratorsTestHelper
- arguments %w(product_line title:string price:integer)
+ arguments %w(product_line title:string product:belongs_to user:references)
setup :copy_routes
@@ -14,7 +14,10 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
assert_file "app/models/product_line.rb", /class ProductLine < ActiveRecord::Base/
assert_file "test/unit/product_line_test.rb", /class ProductLineTest < ActiveSupport::TestCase/
assert_file "test/fixtures/product_lines.yml"
- assert_migration "db/migrate/create_product_lines.rb"
+ assert_migration "db/migrate/create_product_lines.rb", /belongs_to :product/
+ assert_migration "db/migrate/create_product_lines.rb", /add_index :product_lines, :product_id/
+ assert_migration "db/migrate/create_product_lines.rb", /references :user/
+ assert_migration "db/migrate/create_product_lines.rb", /add_index :product_lines, :user_id/
# Route
assert_file "config/routes.rb" do |route|