Permalink
Browse files

Add a test for db:migrate:status to check missing file scenario

  • Loading branch information...
1 parent e75bdcb commit 0813607c7004ab06d35ae75ba205b97cf37122a2 @DNNX DNNX committed Jun 27, 2014
Showing with 15 additions and 0 deletions.
  1. +15 −0 railties/test/application/rake/migrations_test.rb
@@ -184,6 +184,21 @@ class AMigration < ActiveRecord::Migration
assert_match(/create_table "books"/, structure_dump)
end
end
+
+ test 'test migration status migrated file is deleted' do
+ Dir.chdir(app_path) do
+ `rails generate model user username:string password:string;
+ rails generate migration add_email_to_users email:string;
+ rake db:migrate
+ rm db/migrate/*email*.rb`
+
+ output = `rake db:migrate:status`
+ File.write('test.txt', output)
+
+ assert_match(/up\s+\d{14}\s+Create users/, output)
+ assert_match(/up\s+\d{14}\s+\** NO FILE \**/, output)
+ end
+ end
end
end
end

0 comments on commit 0813607

Please sign in to comment.