class ActiveRecord::Migration::PendingMigrationsTest
Public Instance Methods
setup()
click to toggle source
Calls superclass method
# File activerecord/test/cases/migration/pending_migrations_test.rb, line 8 def setup super @connection = Minitest::Mock.new @app = Minitest::Mock.new conn = @connection @pending = Class.new(CheckPending) { define_method(:connection) { conn } }.new(@app) @pending.instance_variable_set :@last_check, -1 # Force checking end
teardown()
click to toggle source
Calls superclass method
# File activerecord/test/cases/migration/pending_migrations_test.rb, line 19 def teardown assert @connection.verify assert @app.verify super end
test_checks_if_supported()
click to toggle source
# File activerecord/test/cases/migration/pending_migrations_test.rb, line 33 def test_checks_if_supported @app.expect :call, nil, [:foo] ActiveRecord::Migrator.stub :needs_migration?, false do @pending.call(:foo) end end
test_errors_if_pending()
click to toggle source
# File activerecord/test/cases/migration/pending_migrations_test.rb, line 25 def test_errors_if_pending ActiveRecord::Migrator.stub :needs_migration?, true do assert_raise ActiveRecord::PendingMigrationError do @pending.call(nil) end end end