mirror of https://github.com/rails/rails
Fix create migration generator with `--pretend` option
This commit is contained in:
parent
c38db72472
commit
557c2e349f
|
@ -20,6 +20,8 @@ module Rails
|
|||
end
|
||||
|
||||
def invoke!
|
||||
return super if pretend?
|
||||
|
||||
invoked_file = super
|
||||
File.exist?(@destination) ? invoked_file : relative_existing_migration
|
||||
end
|
||||
|
|
|
@ -55,6 +55,8 @@ class CreateMigrationTest < Rails::Generators::TestCase
|
|||
def test_invoke_pretended
|
||||
create_migration(default_destination_path, {}, { pretend: true })
|
||||
|
||||
stdout = invoke!
|
||||
assert_match(/create db\/migrate\/1_create_articles\.rb\n/, stdout)
|
||||
assert_no_file @migration.destination
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue