diff options
Diffstat (limited to 'railties/test/application/rake/dbs_test.rb')
| -rw-r--r-- | railties/test/application/rake/dbs_test.rb | 29 | 
1 files changed, 29 insertions, 0 deletions
diff --git a/railties/test/application/rake/dbs_test.rb b/railties/test/application/rake/dbs_test.rb index 15414db00f..267469b6f5 100644 --- a/railties/test/application/rake/dbs_test.rb +++ b/railties/test/application/rake/dbs_test.rb @@ -173,6 +173,35 @@ module ApplicationTests                         "your test schema automatically, see the release notes for details.\n", output          end        end + +      test 'db:setup loads schema and seeds database' do +        begin +          @old_rails_env = ENV["RAILS_ENV"] +          @old_rack_env = ENV["RACK_ENV"] +          ENV.delete "RAILS_ENV" +          ENV.delete "RACK_ENV" + +          app_file 'db/schema.rb', <<-RUBY +            ActiveRecord::Schema.define(version: "1") do +              create_table :users do |t| +                t.string :name +              end +            end +          RUBY + +          app_file 'db/seeds.rb', <<-RUBY +            puts ActiveRecord::Base.connection_config[:database] +          RUBY + +          Dir.chdir(app_path) do +            database_path = `bundle exec rake db:setup` +            assert_equal "development.sqlite3", File.basename(database_path.strip) +          end +        ensure +          ENV["RAILS_ENV"] = @old_rails_env +          ENV["RACK_ENV"] = @old_rack_env +        end +      end      end    end  end  | 
