diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2011-09-10 09:20:02 -0700 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2011-09-10 09:20:02 -0700 |
commit | 0a6756802cb8009566b00f5cda85eb6041e02a55 (patch) | |
tree | d8db48b322382ef7bf73751ad28287028937ffb5 | |
parent | 365aaeac35034fa9d29b4533879db6aa2991e25d (diff) | |
parent | ab5f48718467d7ee94f19fa694fbe51ef1cb5836 (diff) | |
download | rails-0a6756802cb8009566b00f5cda85eb6041e02a55.tar.gz rails-0a6756802cb8009566b00f5cda85eb6041e02a55.tar.bz2 rails-0a6756802cb8009566b00f5cda85eb6041e02a55.zip |
Merge pull request #2970 from deepakprasanna/master
Added a case to check the status of the migration after a rollback and redo.
-rw-r--r-- | railties/test/application/rake_test.rb | 25 |
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` |