Permalink
Browse files

test for structure:dump without schema information table. refs eafec46

This is a test case for the fix provided in eafec46
  • Loading branch information...
1 parent f522aeb commit 582cbff616a927df097353ea8f96c3c1b88f4847 @senny senny committed Mar 20, 2014
Showing with 12 additions and 0 deletions.
  1. +12 −0 railties/test/application/rake/dbs_test.rb
@@ -134,6 +134,18 @@ def db_structure_dump_and_load(expected_database)
db_structure_dump_and_load database_url_db_name
end
+ test 'db:structure:dump does not dump schema information when no migrations are used' do
+ Dir.chdir(app_path) do
+ # create table without migrations
+ `bundle exec rails runner 'ActiveRecord::Base.connection.create_table(:posts) {|t| t.string :title }'`
+
+ stderr_output = capture(:stderr) { `bundle exec rake db:structure:dump` }
+ assert_empty stderr_output
+ structure_dump = File.read("db/structure.sql")
+ assert_match(/CREATE TABLE \"posts\"/, structure_dump)
+ end
+ end
+
def db_test_load_structure
Dir.chdir(app_path) do
`rails generate model book title:string;

0 comments on commit 582cbff

Please sign in to comment.