aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorPiotr Sarnacki <drogus@gmail.com>2010-11-16 17:00:01 +0100
committerPiotr Sarnacki <drogus@gmail.com>2010-11-16 17:00:01 +0100
commit437ceab139c9aace851b41ce6103d29302750e0c (patch)
treef04086ac8ee6c3787e8aae031f1b81a2e7ab393a /activerecord/test/cases
parent510375b501d1a158edf579966a51568d539dcd6e (diff)
downloadrails-437ceab139c9aace851b41ce6103d29302750e0c.tar.gz
rails-437ceab139c9aace851b41ce6103d29302750e0c.tar.bz2
rails-437ceab139c9aace851b41ce6103d29302750e0c.zip
Create directory before copying migrations if it does not exist
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/migration_test.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb
index e6eef805cf..698075ea0c 100644
--- a/activerecord/test/cases/migration_test.rb
+++ b/activerecord/test/cases/migration_test.rb
@@ -2024,6 +2024,21 @@ if ActiveRecord::Base.connection.supports_migrations?
clear
end
+ def test_copying_migrations_to_non_existing_directory
+ @migrations_path = MIGRATIONS_ROOT + "/non_existing"
+ @existing_migrations = []
+
+ Time.travel_to(created_at = Time.utc(2010, 7, 26, 10, 10, 10)) do
+ copied = ActiveRecord::Migration.copy(@migrations_path, {:bukkits => MIGRATIONS_ROOT + "/to_copy_with_timestamps"})
+ assert File.exists?(@migrations_path + "/20100726101010_people_have_hobbies.rb")
+ assert File.exists?(@migrations_path + "/20100726101011_people_have_descriptions.rb")
+ assert_equal 2, copied.length
+ end
+ ensure
+ clear
+ Dir.delete(@migrations_path)
+ end
+
def test_copying_migrations_to_empty_directory
@migrations_path = MIGRATIONS_ROOT + "/empty"
@existing_migrations = []