Skip to content
Browse files

moving verbosity tests to the migrator test, removing ddl changes

  • Loading branch information...
1 parent 5364338 commit 247d274cabae827766c1c5b9deb34fb34548fc5e @tenderlove tenderlove committed Jan 16, 2012
View
3 activerecord/lib/active_record/migration.rb
@@ -341,14 +341,13 @@ def self.migrate(direction)
cattr_accessor :verbose
- attr_accessor :name, :version, :verbose
+ attr_accessor :name, :version
def initialize(name = self.class.name, version = nil)
@name = name
@version = version
@connection = nil
@reverting = false
- @verbose = self.class.verbose
end
# instantiate the delegate object after initialize is defined
View
18 activerecord/test/cases/migration_test.rb
@@ -269,24 +269,6 @@ def test_migrator_db_has_no_schema_migrations_table
end
end
- def test_migrator_verbosity
- ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/valid", 1)
- assert_not_equal 0, ActiveRecord::Migration.message_count
- ActiveRecord::Migration.message_count = 0
-
- ActiveRecord::Migrator.down(MIGRATIONS_ROOT + "/valid", 0)
- assert_not_equal 0, ActiveRecord::Migration.message_count
- ActiveRecord::Migration.message_count = 0
- end
-
- def test_migrator_verbosity_off
- ActiveRecord::Migration.verbose = false
- ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/valid", 1)
- assert_equal 0, ActiveRecord::Migration.message_count
- ActiveRecord::Migrator.down(MIGRATIONS_ROOT + "/valid", 0)
- assert_equal 0, ActiveRecord::Migration.message_count
- end
-
def test_migrator_going_down_due_to_version_target
ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/valid", 1)
ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/valid", 0)
View
24 activerecord/test/cases/migrator_test.rb
@@ -221,6 +221,30 @@ def test_migrator_double_down
assert_equal(0, ActiveRecord::Migrator.current_version)
end
+ def test_migrator_verbosity
+ _, migrations = sensors(3)
+
+ ActiveRecord::Migrator.new(:up, migrations, 1).migrate
+ assert_not_equal 0, ActiveRecord::Migration.message_count
+
+ ActiveRecord::Migration.message_count = 0
+
+ ActiveRecord::Migrator.new(:down, migrations, 0).migrate
+ assert_not_equal 0, ActiveRecord::Migration.message_count
+ ActiveRecord::Migration.message_count = 0
+ end
+
+ def test_migrator_verbosity_off
+ _, migrations = sensors(3)
+
+ ActiveRecord::Migration.message_count = 0
+ ActiveRecord::Migration.verbose = false
+ ActiveRecord::Migrator.new(:up, migrations, 1).migrate
+ assert_equal 0, ActiveRecord::Migration.message_count
+ ActiveRecord::Migrator.new(:down, migrations, 0).migrate
+ assert_equal 0, ActiveRecord::Migration.message_count
+ end
+
private
def m(name, version, &block)
x = Sensor.new name, version

0 comments on commit 247d274

Please sign in to comment.
Something went wrong with that request. Please try again.