aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/generators
diff options
context:
space:
mode:
authorPiotr Sarnacki <drogus@gmail.com>2010-12-10 22:16:34 +0100
committerVijay Dev <vijaydev.cse@gmail.com>2010-12-16 01:49:28 +0530
commit0dc39cd8ee24466f204a292ae61643ce3b3b4c32 (patch)
tree9e2b3ac8e535e1f9ab41665969d2eb058030ee6b /railties/test/generators
parente6928e8c35bfc22425916f334e9482f955bc8907 (diff)
downloadrails-0dc39cd8ee24466f204a292ae61643ce3b3b4c32.tar.gz
rails-0dc39cd8ee24466f204a292ae61643ce3b3b4c32.tar.bz2
rails-0dc39cd8ee24466f204a292ae61643ce3b3b4c32.zip
Skip creating migration if --skip option is passed to model generator [#6144 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'railties/test/generators')
-rw-r--r--railties/test/generators/model_generator_test.rb18
1 files changed, 15 insertions, 3 deletions
diff --git a/railties/test/generators/model_generator_test.rb b/railties/test/generators/model_generator_test.rb
index 8a0f560bc8..552b7eb30a 100644
--- a/railties/test/generators/model_generator_test.rb
+++ b/railties/test/generators/model_generator_test.rb
@@ -147,10 +147,22 @@ class ModelGeneratorTest < Rails::Generators::TestCase
end
end
- def test_migration_already_exists_error_message
+ def test_migration_is_skipped_with_skip_option
run_generator
- error = capture(:stderr){ run_generator ["Account"], :behavior => :skip }
- assert_match /Another migration is already named create_accounts/, error
+ output = run_generator ["Account", "--skip"]
+ assert_match %r{skip\s+db/migrate/\d+_create_accounts.rb}, output
+ end
+
+ def test_migration_is_ignored_as_identical_with_skip_option
+ run_generator ["Account"]
+ output = run_generator ["Account", "--skip"]
+ assert_match %r{identical\s+db/migrate/\d+_create_accounts.rb}, output
+ end
+
+ def test_migration_is_skipped_on_skip_behavior
+ run_generator
+ output = run_generator ["Account"], :behavior => :skip
+ assert_match %r{skip\s+db/migrate/\d+_create_accounts.rb}, output
end
def test_migration_error_is_not_shown_on_revoke