diff options
author | Waseem Ahmad <talk.to.waseem@gmail.com> | 2011-09-09 15:38:27 +0530 |
---|---|---|
committer | Waseem Ahmad <talk.to.waseem@gmail.com> | 2011-09-09 15:39:53 +0530 |
commit | bc7eddea2051a7830cce0edba1d3aed1ea3e36ba (patch) | |
tree | e05f74467a6355e5e4a3d875e864266c4c5d3749 /railties/test | |
parent | b325a77410d5cb5b72145c0dc7a705347fff6368 (diff) | |
download | rails-bc7eddea2051a7830cce0edba1d3aed1ea3e36ba.tar.gz rails-bc7eddea2051a7830cce0edba1d3aed1ea3e36ba.tar.bz2 rails-bc7eddea2051a7830cce0edba1d3aed1ea3e36ba.zip |
Tests for rake db:migrate:status.
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/application/rake_test.rb | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/railties/test/application/rake_test.rb b/railties/test/application/rake_test.rb index 0e03c3dc2d..60538b7bb8 100644 --- a/railties/test/application/rake_test.rb +++ b/railties/test/application/rake_test.rb @@ -219,6 +219,30 @@ module ApplicationTests assert_match(/AddEmailToUsers: reverted/, output) end + def test_migration_status_when_schema_migrations_table_is_not_present + output = Dir.chdir(app_path){ `rake db:migrate:status` } + assert_equal "Schema migrations table does not exist yet.\n", output + end + + def test_migration_status + 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=1` } + output = Dir.chdir(app_path) { `rake db:migrate:status` } + + assert_match(/up\s+\d{14}\s+Create users/, output) + assert_match(/down\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` @@ -245,4 +269,4 @@ module ApplicationTests assert_match(/7 tests, 10 assertions, 0 failures, 0 errors/, content) end end -end
\ No newline at end of file +end |