aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorDeepak Prasanna <deepaksrm@gmail.com>2011-09-10 12:55:37 +0530
committerDeepak Prasanna <deepaksrm@gmail.com>2011-09-10 12:55:37 +0530
commitab5f48718467d7ee94f19fa694fbe51ef1cb5836 (patch)
treeda9794b70a04afe5e4f0a33501428509b51c4ea4 /railties/test
parent4d3a73e5ddcd0ddae8d466e55e1c7c8cdb280343 (diff)
downloadrails-ab5f48718467d7ee94f19fa694fbe51ef1cb5836.tar.gz
rails-ab5f48718467d7ee94f19fa694fbe51ef1cb5836.tar.bz2
rails-ab5f48718467d7ee94f19fa694fbe51ef1cb5836.zip
added test for db migrate:redo
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/application/rake_test.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/railties/test/application/rake_test.rb b/railties/test/application/rake_test.rb
index 6724d939d9..3183162e6c 100644
--- a/railties/test/application/rake_test.rb
+++ b/railties/test/application/rake_test.rb
@@ -150,6 +150,31 @@ module ApplicationTests
assert_match(/down\s+\d{14}\s+Add email to users/, output)
end
+ def test_migration_status_after_rollback_and_redo
+ Dir.chdir(app_path) do
+ `rails generate model user username:string password:string`
+ `rails generate migration add_email_to_users email:string`
+ end
+
+ Dir.chdir(app_path) { `rake db:migrate`}
+ output = Dir.chdir(app_path) { `rake db:migrate:status` }
+
+ assert_match(/up\s+\d{14}\s+Create users/, output)
+ assert_match(/up\s+\d{14}\s+Add email to users/, output)
+
+ Dir.chdir(app_path) { `rake db:rollback STEP=2` }
+ output = Dir.chdir(app_path) { `rake db:migrate:status` }
+
+ assert_match(/down\s+\d{14}\s+Create users/, output)
+ assert_match(/down\s+\d{14}\s+Add email to users/, output)
+
+ Dir.chdir(app_path) { `rake db:migrate:redo` }
+ output = Dir.chdir(app_path) { `rake db:migrate:status` }
+
+ assert_match(/up\s+\d{14}\s+Create users/, output)
+ assert_match(/up\s+\d{14}\s+Add email to users/, output)
+ end
+
def test_loading_specific_fixtures
Dir.chdir(app_path) do
`rails generate model user username:string password:string`