diff options
author | kennyj <kennyj@gmail.com> | 2012-06-21 01:35:26 +0900 |
---|---|---|
committer | kennyj <kennyj@gmail.com> | 2012-06-21 01:35:26 +0900 |
commit | 19911959d9a8fa5341f61b028cb489e6ecc2c339 (patch) | |
tree | 539f3aedfa8167aced878adba05845e46c796f86 /activerecord/test/cases/sqlite_rake_test.rb | |
parent | 4f700edcc094406155785c693363801d0277792c (diff) | |
download | rails-19911959d9a8fa5341f61b028cb489e6ecc2c339.tar.gz rails-19911959d9a8fa5341f61b028cb489e6ecc2c339.tar.bz2 rails-19911959d9a8fa5341f61b028cb489e6ecc2c339.zip |
Refactor db:structure:load task.
Diffstat (limited to 'activerecord/test/cases/sqlite_rake_test.rb')
-rw-r--r-- | activerecord/test/cases/sqlite_rake_test.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/activerecord/test/cases/sqlite_rake_test.rb b/activerecord/test/cases/sqlite_rake_test.rb index 69fb129326..b5557fc953 100644 --- a/activerecord/test/cases/sqlite_rake_test.rb +++ b/activerecord/test/cases/sqlite_rake_test.rb @@ -145,4 +145,26 @@ module ActiveRecord FileUtils.rm(dbfile) end end + + class SqliteStructureLoadTest < ActiveRecord::TestCase + def setup + @database = "db_create.sqlite3" + @configuration = { + 'adapter' => 'sqlite3', + 'database' => @database + } + end + + def test_structure_load + dbfile = @database + filename = "awesome-file.sql" + + open(filename, 'w') { |f| f.puts("select datetime('now', 'localtime');") } + ActiveRecord::Tasks::DatabaseTasks.structure_load @configuration, filename, '/rails/root' + assert File.exists?(dbfile) + ensure + FileUtils.rm(filename) + FileUtils.rm(dbfile) + end + end end |