Skip to content

Commit

Permalink
move another migrator to use sensors
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Jan 16, 2012
1 parent 8c0c083 commit 15daa14
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
12 changes: 0 additions & 12 deletions activerecord/test/cases/migration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -245,18 +245,6 @@ def test_only_loads_pending_migrations
assert names.include?('InnocentJointable')
end

def test_target_version_zero_should_run_only_once
# migrate up to 1
ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/valid", 1)

# migrate down to 0
ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/valid", 0)

# migrate down to 0 again
proxies = ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/valid", 0)
assert_equal [], proxies
end

def test_migrator_db_has_no_schema_migrations_table
# Oracle adapter raises error if semicolon is present as last character
if current_adapter?(:OracleAdapter)
Expand Down
18 changes: 18 additions & 0 deletions activerecord/test/cases/migrator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,24 @@ def test_migrator_verbosity_off
assert_equal 0, ActiveRecord::Migration.message_count
end

def test_target_version_zero_should_run_only_once
calls, migrations = sensors(3)

# migrate up to 1
ActiveRecord::Migrator.new(:up, migrations, 1).migrate
assert_equal [[:up, 0], [:up, 1]], calls
calls.clear

# migrate down to 0
ActiveRecord::Migrator.new(:down, migrations, 0).migrate
assert_equal [[:down, 1]], calls
calls.clear

# migrate down to 0 again
ActiveRecord::Migrator.new(:down, migrations, 0).migrate
assert_equal [], calls
end

private
def m(name, version, &block)
x = Sensor.new name, version
Expand Down

0 comments on commit 15daa14

Please sign in to comment.