diff options
author | Xavier Noria <fxn@hashref.com> | 2010-06-20 23:13:19 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2010-06-20 23:13:19 +0200 |
commit | 207fa59675cb624dde0e01c1d57597f752cdf095 (patch) | |
tree | 472d03af5bc3e2df1b759717f723ca914f2a77aa /railties/test/generators | |
parent | 31cadc730a40281950a265ff6982dd76cc326828 (diff) | |
parent | 50d37a76064239a731f81a4ba68b80946c4dfae2 (diff) | |
download | rails-207fa59675cb624dde0e01c1d57597f752cdf095.tar.gz rails-207fa59675cb624dde0e01c1d57597f752cdf095.tar.bz2 rails-207fa59675cb624dde0e01c1d57597f752cdf095.zip |
Merge remote branch 'rails/master'
Conflicts:
actionpack/lib/abstract_controller/base.rb
Diffstat (limited to 'railties/test/generators')
-rw-r--r-- | railties/test/generators/migration_generator_test.rb | 15 | ||||
-rw-r--r-- | railties/test/generators/named_base_test.rb | 10 |
2 files changed, 25 insertions, 0 deletions
diff --git a/railties/test/generators/migration_generator_test.rb b/railties/test/generators/migration_generator_test.rb index 6ea722e239..f9d1e42d24 100644 --- a/railties/test/generators/migration_generator_test.rb +++ b/railties/test/generators/migration_generator_test.rb @@ -62,4 +62,19 @@ class MigrationGeneratorTest < Rails::Generators::TestCase end end end + + def test_should_create_empty_migrations_if_name_not_start_with_add_or_remove + migration = "create_books" + run_generator [migration, "title:string", "content:text"] + + assert_migration "db/migrate/#{migration}.rb" do |content| + assert_class_method :up, content do |up| + assert_match /^\s*$/, up + end + + assert_class_method :down, content do |down| + assert_match /^\s*$/, down + end + end + end end diff --git a/railties/test/generators/named_base_test.rb b/railties/test/generators/named_base_test.rb index e73dd237fb..1badae0713 100644 --- a/railties/test/generators/named_base_test.rb +++ b/railties/test/generators/named_base_test.rb @@ -93,6 +93,16 @@ class NamedBaseTest < Rails::Generators::TestCase assert_name g, "application", :application_name end + def test_index_helper + g = generator ['Post'] + assert_name g, 'posts', :index_helper + end + + def test_index_helper_with_uncountable + g = generator ['Sheep'] + assert_name g, 'sheep_index', :index_helper + end + protected def assert_name(generator, value, method) |