Skip to content
This repository
Browse code

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 Arondekar authored June 20, 2010 josevalim committed June 20, 2010
15  railties/test/generators/migration_generator_test.rb
@@ -62,4 +62,19 @@ def test_remove_migration_with_attributes
62 62
       end
63 63
     end
64 64
   end
  65
+
  66
+  def test_should_create_empty_migrations_if_name_not_start_with_add_or_remove
  67
+    migration = "create_books"
  68
+    run_generator [migration, "title:string", "content:text"]
  69
+
  70
+    assert_migration "db/migrate/#{migration}.rb" do |content|
  71
+      assert_class_method :up, content do |up|
  72
+        assert_match /^\s*$/, up
  73
+      end
  74
+
  75
+      assert_class_method :down, content do |down|
  76
+        assert_match /^\s*$/, down
  77
+      end
  78
+    end
  79
+  end
65 80
 end

0 notes on commit d061050

Please sign in to comment.
Something went wrong with that request. Please try again.