diff options
author | Josh Susser <josh@hasmanythrough.com> | 2010-03-20 18:26:12 -0700 |
---|---|---|
committer | Josh Susser <josh@hasmanythrough.com> | 2010-12-01 10:57:38 -0800 |
commit | 7139aa878ceea8dd17a60955cd4d07f5f68980d9 (patch) | |
tree | 6246048e1a611d770a3f5b5b0208c6597cbd646a /activerecord/test/cases/ar_schema_test.rb | |
parent | 4e4e9ad48a222ac94a904c62ae684c609bd8e177 (diff) | |
download | rails-7139aa878ceea8dd17a60955cd4d07f5f68980d9.tar.gz rails-7139aa878ceea8dd17a60955cd4d07f5f68980d9.tar.bz2 rails-7139aa878ceea8dd17a60955cd4d07f5f68980d9.zip |
name in schema_migrations, migrations in schema dump
Diffstat (limited to 'activerecord/test/cases/ar_schema_test.rb')
-rw-r--r-- | activerecord/test/cases/ar_schema_test.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/activerecord/test/cases/ar_schema_test.rb b/activerecord/test/cases/ar_schema_test.rb index 588adc38e3..e7f3907ff5 100644 --- a/activerecord/test/cases/ar_schema_test.rb +++ b/activerecord/test/cases/ar_schema_test.rb @@ -39,4 +39,27 @@ if ActiveRecord::Base.connection.supports_migrations? end end + class ActiveRecordSchemaMigrationsTest < ActiveRecordSchemaTest + def setup + super + @sm_table = ActiveRecord::Migrator.schema_migrations_table_name + @connection.execute "DELETE FROM #{@connection.quote_table_name(@sm_table)}" + end + + def test_migration_adds_row_to_migrations_table + ActiveRecord::Schema.migration("123001") + ActiveRecord::Schema.migration("123002", "add_magic_power_to_unicorns") + rows = @connection.select_all("SELECT * FROM #{@connection.quote_table_name(@sm_table)}") + assert_equal 2, rows.length + + assert_equal "123001", rows[0]["version"] + assert_equal "", rows[0]["name"] + assert_match /^2\d\d\d-/, rows[0]["migrated_at"] + + assert_equal "123002", rows[1]["version"] + assert_equal "add_magic_power_to_unicorns", rows[1]["name"] + assert_match /^2\d\d\d-/, rows[1]["migrated_at"] + end + end + end |