diff options
author | José Valim <jose.valim@gmail.com> | 2011-12-24 10:38:19 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-12-24 10:38:19 +0100 |
commit | b4e97ea2d961c7ed99dcfa48044f4922378ff9cf (patch) | |
tree | 9aac1ae030dfc9ad9e7cef22e5d05e35011e5af1 /railties/test/generators | |
parent | 7a47f362c8246c20437f49111e5dcc0781d6d024 (diff) | |
download | rails-b4e97ea2d961c7ed99dcfa48044f4922378ff9cf.tar.gz rails-b4e97ea2d961c7ed99dcfa48044f4922378ff9cf.tar.bz2 rails-b4e97ea2d961c7ed99dcfa48044f4922378ff9cf.zip |
Tidy up migration types.
Diffstat (limited to 'railties/test/generators')
-rw-r--r-- | railties/test/generators/generated_attribute_test.rb | 7 | ||||
-rw-r--r-- | railties/test/generators/migration_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/model_generator_test.rb | 2 |
3 files changed, 8 insertions, 3 deletions
diff --git a/railties/test/generators/generated_attribute_test.rb b/railties/test/generators/generated_attribute_test.rb index ea6c6e4e2c..6e3fc84781 100644 --- a/railties/test/generators/generated_attribute_test.rb +++ b/railties/test/generators/generated_attribute_test.rb @@ -69,7 +69,7 @@ class GeneratedAttributeTest < Rails::Generators::TestCase end def test_default_value_for_type - att = Rails::Generators::GeneratedAttribute.new("type:string") + att = Rails::Generators::GeneratedAttribute.parse("type:string") assert_equal("", att.default) end @@ -122,4 +122,9 @@ class GeneratedAttributeTest < Rails::Generators::TestCase assert_equal :string, create_generated_attribute(nil, 'title').type assert_equal :string, create_generated_attribute("", 'title').type end + + def test_handles_index_names_for_references + assert_equal "post", create_generated_attribute('string', 'post').index_name + assert_equal "post_id", create_generated_attribute('references', 'post').index_name + end end diff --git a/railties/test/generators/migration_generator_test.rb b/railties/test/generators/migration_generator_test.rb index 6b6c9dee7c..9da1b53c96 100644 --- a/railties/test/generators/migration_generator_test.rb +++ b/railties/test/generators/migration_generator_test.rb @@ -60,7 +60,7 @@ class MigrationGeneratorTest < Rails::Generators::TestCase def test_add_migration_with_attributes_and_indices migration = "add_title_with_index_and_body_to_posts" - run_generator [migration, "title:string:index", "body:text", "user_id:integer:unique"] + run_generator [migration, "title:string:index", "body:text", "user_id:integer:uniq"] assert_migration "db/migrate/#{migration}.rb" do |content| assert_method :change, content do |up| diff --git a/railties/test/generators/model_generator_test.rb b/railties/test/generators/model_generator_test.rb index 7a8cf1d8a7..c063d4d687 100644 --- a/railties/test/generators/model_generator_test.rb +++ b/railties/test/generators/model_generator_test.rb @@ -114,7 +114,7 @@ class ModelGeneratorTest < Rails::Generators::TestCase end def test_migration_with_attributes_and_with_index - run_generator ["product", "name:string:index", "supplier_id:integer:index", "user_id:integer:uniq", "order_id:unique"] + run_generator ["product", "name:string:index", "supplier_id:integer:index", "user_id:integer:uniq", "order_id:uniq"] assert_migration "db/migrate/create_products.rb" do |m| assert_method :change, m do |up| |