Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add test for migration generator with name not starting with add or r…

…emove. [#4835 state:committed]

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
commit d06105063829d44adf641059ef97f54d7b690f4b 1 parent 4515947
@rohit rohit authored josevalim committed
Showing with 15 additions and 0 deletions.
  1. +15 −0 railties/test/generators/migration_generator_test.rb
View
15 railties/test/generators/migration_generator_test.rb
@@ -62,4 +62,19 @@ def test_remove_migration_with_attributes
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
Please sign in to comment.
Something went wrong with that request. Please try again.