提交 0212a417 编写于 作者: G Guo Xiang Tan
上级 74d7df17
......@@ -4,12 +4,12 @@ class MysqlConnectionTest < ActiveRecord::TestCase
def setup
super
@subscriber = SQLSubscriber.new
ActiveSupport::Notifications.subscribe('sql.active_record', @subscriber)
@subscription = ActiveSupport::Notifications.subscribe('sql.active_record', @subscriber)
@connection = ActiveRecord::Base.connection
end
def teardown
ActiveSupport::Notifications.unsubscribe(@subscriber)
ActiveSupport::Notifications.unsubscribe(@subscription)
super
end
......
......@@ -8,12 +8,12 @@ class NonExistentTable < ActiveRecord::Base
def setup
super
@subscriber = SQLSubscriber.new
ActiveSupport::Notifications.subscribe('sql.active_record', @subscriber)
@subscription = ActiveSupport::Notifications.subscribe('sql.active_record', @subscriber)
@connection = ActiveRecord::Base.connection
end
def teardown
ActiveSupport::Notifications.unsubscribe(@subscriber)
ActiveSupport::Notifications.unsubscribe(@subscription)
super
end
......
......@@ -23,7 +23,7 @@ def setup
eosql
@subscriber = SQLSubscriber.new
ActiveSupport::Notifications.subscribe('sql.active_record', @subscriber)
@subscription = ActiveSupport::Notifications.subscribe('sql.active_record', @subscriber)
end
def test_bad_connection
......@@ -70,7 +70,7 @@ def test_invalid_column
end
def teardown
ActiveSupport::Notifications.unsubscribe(@subscriber)
ActiveSupport::Notifications.unsubscribe(@subscription)
super
end
......
......@@ -22,11 +22,11 @@ def setup
@connection = ActiveRecord::Base.connection
@listener = LogListener.new
@pk = Topic.columns.find { |c| c.primary }
ActiveSupport::Notifications.subscribe('sql.active_record', @listener)
@subscriber = ActiveSupport::Notifications.subscribe('sql.active_record', @listener)
end
teardown do
ActiveSupport::Notifications.unsubscribe(@listener)
ActiveSupport::Notifications.unsubscribe(@subscriber)
end
if ActiveRecord::Base.connection.supports_statement_cache?
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册