diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-01 17:08:01 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-01 17:08:01 -0800 |
commit | 3ec212e3c9c815e9993cbea409c60774ea75cd30 (patch) | |
tree | 56f77db136192f65eb4e3a1417d8b989e56cfe37 /activerecord/test/cases | |
parent | c15c14563e6604aab232336b16e14f1f235cc19d (diff) | |
download | rails-3ec212e3c9c815e9993cbea409c60774ea75cd30.tar.gz rails-3ec212e3c9c815e9993cbea409c60774ea75cd30.tar.bz2 rails-3ec212e3c9c815e9993cbea409c60774ea75cd30.zip |
rolling out migrated_at until I can fix the build
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/ar_schema_test.rb | 35 | ||||
-rw-r--r-- | activerecord/test/cases/migration_test.rb | 52 | ||||
-rw-r--r-- | activerecord/test/cases/schema_dumper_test.rb | 19 |
3 files changed, 7 insertions, 99 deletions
diff --git a/activerecord/test/cases/ar_schema_test.rb b/activerecord/test/cases/ar_schema_test.rb index df51a6e4ba..588adc38e3 100644 --- a/activerecord/test/cases/ar_schema_test.rb +++ b/activerecord/test/cases/ar_schema_test.rb @@ -39,39 +39,4 @@ 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 - schema = ActiveRecord::Schema.new - schema.migration("123001") - 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_not_nil(rows[0]["migrated_at"]) - - assert_equal "123002", rows[1]["version"] - assert_equal "add_magic_power_to_unicorns", rows[1]["name"] - assert_not_nil(rows[1]["migrated_at"]) - end - - def test_define_clears_schema_migrations - assert_nothing_raised do - ActiveRecord::Schema.define do - migration("123001") - end - ActiveRecord::Schema.define do - migration("123001") - end - end - end - end - end diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb index b698a5a3cf..3037d73a1b 100644 --- a/activerecord/test/cases/migration_test.rb +++ b/activerecord/test/cases/migration_test.rb @@ -27,46 +27,22 @@ if ActiveRecord::Base.connection.supports_migrations? end class MigrationTableAndIndexTest < ActiveRecord::TestCase - def setup - @conn = ActiveRecord::Base.connection - @conn.drop_table(ActiveRecord::Migrator.schema_migrations_table_name) if @conn.table_exists?(ActiveRecord::Migrator.schema_migrations_table_name) - end + def test_add_schema_info_respects_prefix_and_suffix + conn = ActiveRecord::Base.connection - def test_add_schema_migrations_respects_prefix_and_suffix + conn.drop_table(ActiveRecord::Migrator.schema_migrations_table_name) if conn.table_exists?(ActiveRecord::Migrator.schema_migrations_table_name) # Use shorter prefix and suffix as in Oracle database identifier cannot be larger than 30 characters ActiveRecord::Base.table_name_prefix = 'p_' ActiveRecord::Base.table_name_suffix = '_s' - @conn.drop_table(ActiveRecord::Migrator.schema_migrations_table_name) if @conn.table_exists?(ActiveRecord::Migrator.schema_migrations_table_name) + conn.drop_table(ActiveRecord::Migrator.schema_migrations_table_name) if conn.table_exists?(ActiveRecord::Migrator.schema_migrations_table_name) - @conn.initialize_schema_migrations_table + conn.initialize_schema_migrations_table - assert_equal "p_unique_schema_migrations_s", @conn.indexes(ActiveRecord::Migrator.schema_migrations_table_name)[0][:name] + assert_equal "p_unique_schema_migrations_s", conn.indexes(ActiveRecord::Migrator.schema_migrations_table_name)[0][:name] ensure ActiveRecord::Base.table_name_prefix = "" ActiveRecord::Base.table_name_suffix = "" end - - def test_schema_migrations_columns - @conn.initialize_schema_migrations_table - - columns = @conn.columns(ActiveRecord::Migrator.schema_migrations_table_name).collect(&:name) - %w[version name migrated_at].each { |col| assert columns.include?(col) } - end - - def test_add_name_and_migrated_at_to_exisiting_schema_migrations - sm_table = ActiveRecord::Migrator.schema_migrations_table_name - @conn.create_table(sm_table, :id => false) do |schema_migrations_table| - schema_migrations_table.column :version, :string, :null => false - end - @conn.insert "INSERT INTO #{@conn.quote_table_name(sm_table)} (version) VALUES (100)" - @conn.insert "INSERT INTO #{@conn.quote_table_name(sm_table)} (version) VALUES (200)" - - @conn.initialize_schema_migrations_table - - rows = @conn.select_all("SELECT * FROM #{@conn.quote_table_name(sm_table)}") - assert rows[0].has_key?("name") - assert rows[0].has_key?("migrated_at") - end end class MigrationTest < ActiveRecord::TestCase @@ -1462,21 +1438,6 @@ if ActiveRecord::Base.connection.supports_migrations? ActiveRecord::Base.table_name_suffix = "" end - def test_migration_row_includes_name_and_timestamp - conn = ActiveRecord::Base.connection - sm_table = ActiveRecord::Migrator.schema_migrations_table_name - - ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/valid") - - rows = conn.select_all("SELECT * FROM #{conn.quote_table_name(sm_table)}") - rows.each do |row| - assert_not_nil(row["migrated_at"], "missing migrated_at") - end - assert_equal "people_have_last_names", rows[0]["name"] - assert_equal "we_need_reminders", rows[1]["name"] - assert_equal "innocent_jointable", rows[2]["name"] - end - def test_proper_table_name assert_equal "table", ActiveRecord::Migrator.proper_table_name('table') assert_equal "table", ActiveRecord::Migrator.proper_table_name(:table) @@ -2132,3 +2093,4 @@ if ActiveRecord::Base.connection.supports_migrations? end end end + diff --git a/activerecord/test/cases/schema_dumper_test.rb b/activerecord/test/cases/schema_dumper_test.rb index 7914ee0a6f..9b2c7c00df 100644 --- a/activerecord/test/cases/schema_dumper_test.rb +++ b/activerecord/test/cases/schema_dumper_test.rb @@ -17,25 +17,6 @@ class SchemaDumperTest < ActiveRecord::TestCase assert_no_match %r{create_table "schema_migrations"}, output end - def test_schema_dump_includes_migrations - $".delete_if do |fname| - fname == (MIGRATIONS_ROOT + "/valid/1_people_have_last_names.rb") - end - - conn = ActiveRecord::Base.connection - sm_table = ActiveRecord::Migrator.schema_migrations_table_name - conn.execute "DELETE FROM #{conn.quote_table_name(sm_table)}" - conn.remove_column "people", "last_name" rescue nil - conn.drop_table "reminders" rescue nil - conn.drop_table "people_reminders" rescue nil - ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/valid") - - output = standard_dump - assert_match %r{migration "1", "people_have_last_names"}, output - assert_match %r{migration "2", "we_need_reminders"}, output - assert_match %r{migration "3", "innocent_jointable"}, output - end - def test_schema_dump_excludes_sqlite_sequence output = standard_dump assert_no_match %r{create_table "sqlite_sequence"}, output |