mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Add test cases for model and migration generators which use change
method.
This commit is contained in:
parent
ad343d7263
commit
4805ec1449
1 changed files with 19 additions and 0 deletions
|
@ -63,5 +63,24 @@ module ApplicationTests
|
|||
RUBY
|
||||
assert_match 'cart GET /cart(.:format)', Dir.chdir(app_path){ `rake routes` }
|
||||
end
|
||||
|
||||
def test_model_and_migration_generator_with_change_syntax
|
||||
Dir.chdir(app_path) do
|
||||
`rails generate model user username:string password:string`
|
||||
`rails generate migration add_email_to_users email:string`
|
||||
end
|
||||
|
||||
output = Dir.chdir(app_path){ `rake db:migrate` }
|
||||
assert_match /create_table\(:users\)/, output
|
||||
assert_match /CreateUsers: migrated/, output
|
||||
assert_match /add_column\(:users, :email, :string\)/, output
|
||||
assert_match /AddEmailToUsers: migrated/, output
|
||||
|
||||
output = Dir.chdir(app_path){ `rake db:rollback STEP=2` }
|
||||
assert_match /drop_table\("users"\)/, output
|
||||
assert_match /CreateUsers: reverted/, output
|
||||
assert_match /remove_column\("users", :email\)/, output
|
||||
assert_match /AddEmailToUsers: reverted/, output
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue