diff options
author | rohit <rohit.arondekar@gmail.com> | 2010-06-20 07:38:06 +0530 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-06-20 12:32:56 +0200 |
commit | d06105063829d44adf641059ef97f54d7b690f4b (patch) | |
tree | 7fee04cb326519a76e8a3e390cfd9ab87e9ba91b | |
parent | 451594784552bd6955687d8ff617c484ec26946b (diff) | |
download | rails-d06105063829d44adf641059ef97f54d7b690f4b.tar.gz rails-d06105063829d44adf641059ef97f54d7b690f4b.tar.bz2 rails-d06105063829d44adf641059ef97f54d7b690f4b.zip |
Add test for migration generator with name not starting with add or remove. [#4835 state:committed]
Signed-off-by: José Valim <jose.valim@gmail.com>
-rw-r--r-- | railties/test/generators/migration_generator_test.rb | 15 |
1 files changed, 15 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 |