mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Add test to properly test down with a block
down is only called with a block from the rake tasks where it passes a
`SCOPE`. Technically this was tested but since we don't run all the
migrations we're not actually testing the down works with a `SCOPE`. To
ensure we're testing both we can run `db:migrate` again to migrate users
and then run `down` with a scope to test that only the bukkits migration
is reverted.
Updates test to prevent having to fix regressions like we did in
4d4db4c
.
This commit is contained in:
parent
4d4db4c861
commit
e0ad907ade
1 changed files with 8 additions and 0 deletions
|
@ -29,12 +29,20 @@ module ApplicationTests
|
|||
|
||||
assert_match(/AMigration: migrated/, output)
|
||||
|
||||
# run all the migrations to test scope for down
|
||||
output = rails("db:migrate")
|
||||
assert_match(/CreateUsers: migrated/, output)
|
||||
|
||||
output = rails("db:migrate", "SCOPE=bukkits", "VERSION=0")
|
||||
assert_no_match(/drop_table\(:users\)/, output)
|
||||
assert_no_match(/CreateUsers/, output)
|
||||
assert_no_match(/remove_column\(:users, :email\)/, output)
|
||||
|
||||
assert_match(/AMigration: reverted/, output)
|
||||
|
||||
output = rails("db:migrate", "VERSION=0")
|
||||
|
||||
assert_match(/CreateUsers: reverted/, output)
|
||||
end
|
||||
|
||||
test "version outputs current version" do
|
||||
|
|
Loading…
Reference in a new issue