Skip to content

Commit

Permalink
silencing migrator tests, refactoring the migration test helper
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Jan 16, 2012
1 parent 7312b83 commit 5364338
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 23 deletions.
3 changes: 2 additions & 1 deletion activerecord/lib/active_record/migration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -341,13 +341,14 @@ def self.migrate(direction)

cattr_accessor :verbose

attr_accessor :name, :version
attr_accessor :name, :version, :verbose

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
Expand Down
9 changes: 9 additions & 0 deletions activerecord/test/cases/migration/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

module ActiveRecord
class Migration
class << self
attr_accessor :message_count
end

def puts(text="")
ActiveRecord::Migration.message_count ||= 0
ActiveRecord::Migration.message_count += 1
end

module TestHelper
attr_reader :connection, :table_name

Expand Down
23 changes: 1 addition & 22 deletions activerecord/test/cases/migration_test.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require "cases/helper"
require "cases/migration/helper"
require 'bigdecimal/util'

require 'models/person'
Expand All @@ -16,28 +17,6 @@ class Reminder < ActiveRecord::Base; end

class Thing < ActiveRecord::Base; end

class ActiveRecord::Migration
class << self
attr_accessor :message_count
end

def puts(text="")
ActiveRecord::Migration.message_count ||= 0
ActiveRecord::Migration.message_count += 1
end
end

module ActiveRecord
class MigrationTest < ActiveRecord::TestCase
attr_reader :connection

def setup
super
@connection = Base.connection
end
end
end

class MigrationTest < ActiveRecord::TestCase
self.use_transactional_fixtures = false

Expand Down
1 change: 1 addition & 0 deletions activerecord/test/cases/migrator_test.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require "cases/helper"
require "cases/migration/helper"

module ActiveRecord
class MigratorTest < ActiveRecord::TestCase
Expand Down

0 comments on commit 5364338

Please sign in to comment.