diff options
author | Yves Senn <yves.senn@gmail.com> | 2014-03-29 14:52:56 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2014-03-29 14:53:29 +0100 |
commit | 0b33c06475e6d8f4e52e3bfc98e2e897a4155bc6 (patch) | |
tree | 52b67ba6b261140d90ee526ee4dc0a2dac75dce4 /activerecord/test/cases | |
parent | 66b42a67af60025ce5f393e13589dfcdf9409334 (diff) | |
parent | 0212a41700a4e9cd0a6eb2a0811608ea13f8c5b3 (diff) | |
download | rails-0b33c06475e6d8f4e52e3bfc98e2e897a4155bc6.tar.gz rails-0b33c06475e6d8f4e52e3bfc98e2e897a4155bc6.tar.bz2 rails-0b33c06475e6d8f4e52e3bfc98e2e897a4155bc6.zip |
Merge pull request #14524 from tgxworld/fix_unsubscribe_from_notifications
Fix tests not unsubscribing from Notifications.
Diffstat (limited to 'activerecord/test/cases')
4 files changed, 12 insertions, 12 deletions
diff --git a/activerecord/test/cases/adapters/mysql2/connection_test.rb b/activerecord/test/cases/adapters/mysql2/connection_test.rb index 98febd2d75..57d8b8dd99 100644 --- a/activerecord/test/cases/adapters/mysql2/connection_test.rb +++ b/activerecord/test/cases/adapters/mysql2/connection_test.rb @@ -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 diff --git a/activerecord/test/cases/adapters/postgresql/connection_test.rb b/activerecord/test/cases/adapters/postgresql/connection_test.rb index aa4996133f..514ae20e3c 100644 --- a/activerecord/test/cases/adapters/postgresql/connection_test.rb +++ b/activerecord/test/cases/adapters/postgresql/connection_test.rb @@ -8,12 +8,12 @@ module ActiveRecord 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 diff --git a/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb b/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb index 73cb739b2b..78c6e27ff3 100644 --- a/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb +++ b/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb @@ -23,7 +23,7 @@ module ActiveRecord 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 @@ module ActiveRecord end def teardown - ActiveSupport::Notifications.unsubscribe(@subscriber) + ActiveSupport::Notifications.unsubscribe(@subscription) super end diff --git a/activerecord/test/cases/bind_parameter_test.rb b/activerecord/test/cases/bind_parameter_test.rb index 24eb91bef9..40f73cd68c 100644 --- a/activerecord/test/cases/bind_parameter_test.rb +++ b/activerecord/test/cases/bind_parameter_test.rb @@ -20,13 +20,13 @@ module ActiveRecord def setup super @connection = ActiveRecord::Base.connection - @listener = LogListener.new + @subscriber = LogListener.new @pk = Topic.columns.find { |c| c.primary } - ActiveSupport::Notifications.subscribe('sql.active_record', @listener) + @subscription = ActiveSupport::Notifications.subscribe('sql.active_record', @subscriber) end teardown do - ActiveSupport::Notifications.unsubscribe(@listener) + ActiveSupport::Notifications.unsubscribe(@subscription) end if ActiveRecord::Base.connection.supports_statement_cache? @@ -37,7 +37,7 @@ module ActiveRecord @connection.exec_query(sql, 'SQL', binds) - message = @listener.calls.find { |args| args[4][:sql] == sql } + message = @subscriber.calls.find { |args| args[4][:sql] == sql } assert_equal binds, message[4][:binds] end @@ -48,14 +48,14 @@ module ActiveRecord @connection.exec_query(sql, 'SQL', binds) - message = @listener.calls.find { |args| args[4][:sql] == sql } + message = @subscriber.calls.find { |args| args[4][:sql] == sql } assert_equal [[@pk, 3]], message[4][:binds] end def test_find_one_uses_binds Topic.find(1) binds = [[@pk, 1]] - message = @listener.calls.find { |args| args[4][:binds] == binds } + message = @subscriber.calls.find { |args| args[4][:binds] == binds } assert message, 'expected a message with binds' end |