Permalink
Browse files

Fix tests not unsubscribing from Notifications.

  • Loading branch information...
1 parent 74d7df1 commit 0212a41700a4e9cd0a6eb2a0811608ea13f8c5b3 @tgxworld tgxworld committed Mar 29, 2014
@@ -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?

0 comments on commit 0212a41

Please sign in to comment.