aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorNick Sieger <nick@nicksieger.com>2008-08-22 12:19:29 -0500
committerNick Sieger <nick@nicksieger.com>2008-08-29 14:12:12 -0500
commitca6d71753f3a2e8a0a29108b7c55ba3b7c8cd943 (patch)
treed0527720f9d7ceaa46fd6a8844fecd46aaa0ae18 /activerecord/test
parenta96b7d4c33757364a19ed1fc34f0a89801b8b2d7 (diff)
downloadrails-ca6d71753f3a2e8a0a29108b7c55ba3b7c8cd943.tar.gz
rails-ca6d71753f3a2e8a0a29108b7c55ba3b7c8cd943.tar.bz2
rails-ca6d71753f3a2e8a0a29108b7c55ba3b7c8cd943.zip
Deprecate allow_concurrency and make it have no effect
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/base_test.rb2
-rw-r--r--activerecord/test/cases/locking_test.rb7
-rw-r--r--activerecord/test/cases/threaded_connections_test.rb42
-rw-r--r--activerecord/test/cases/transactions_test.rb11
4 files changed, 7 insertions, 55 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb
index c8111358e3..ac9081e003 100644
--- a/activerecord/test/cases/base_test.rb
+++ b/activerecord/test/cases/base_test.rb
@@ -880,7 +880,7 @@ class BasicsTest < ActiveRecord::TestCase
def test_mass_assignment_protection_against_class_attribute_writers
[:logger, :configurations, :primary_key_prefix_type, :table_name_prefix, :table_name_suffix, :pluralize_table_names, :colorize_logging,
- :default_timezone, :allow_concurrency, :schema_format, :verification_timeout, :lock_optimistically, :record_timestamps].each do |method|
+ :default_timezone, :schema_format, :verification_timeout, :lock_optimistically, :record_timestamps].each do |method|
assert Task.respond_to?(method)
assert Task.respond_to?("#{method}=")
assert Task.new.respond_to?(method)
diff --git a/activerecord/test/cases/locking_test.rb b/activerecord/test/cases/locking_test.rb
index 701187223f..bbe8582466 100644
--- a/activerecord/test/cases/locking_test.rb
+++ b/activerecord/test/cases/locking_test.rb
@@ -210,13 +210,6 @@ unless current_adapter?(:SQLServerAdapter, :SybaseAdapter, :OpenBaseAdapter)
def setup
# Avoid introspection queries during tests.
Person.columns; Reader.columns
-
- @allow_concurrency = ActiveRecord::Base.allow_concurrency
- ActiveRecord::Base.allow_concurrency = true
- end
-
- def teardown
- ActiveRecord::Base.allow_concurrency = @allow_concurrency
end
# Test typical find.
diff --git a/activerecord/test/cases/threaded_connections_test.rb b/activerecord/test/cases/threaded_connections_test.rb
index 892a99f85a..7246a8a62b 100644
--- a/activerecord/test/cases/threaded_connections_test.rb
+++ b/activerecord/test/cases/threaded_connections_test.rb
@@ -4,53 +4,23 @@ require 'models/reply'
unless %w(FrontBase).include? ActiveRecord::Base.connection.adapter_name
class ThreadedConnectionsTest < ActiveRecord::TestCase
- self.use_transactional_fixtures = false
-
- fixtures :topics
-
- def setup
- @connection = ActiveRecord::Base.remove_connection
- @connections = []
- @allow_concurrency = ActiveRecord::Base.allow_concurrency
- ActiveRecord::Base.allow_concurrency = true
- end
-
- def teardown
- # clear the connection cache
- ActiveRecord::Base.clear_active_connections!
- # set allow_concurrency to saved value
- ActiveRecord::Base.allow_concurrency = @allow_concurrency
- # reestablish old connection
- ActiveRecord::Base.establish_connection(@connection)
- end
-
- def gather_connections
- ActiveRecord::Base.establish_connection(@connection)
-
- 5.times do
- Thread.new do
- Topic.find :first
- @connections << ActiveRecord::Base.active_connections.values.first
- end.join
+ def test_allow_concurrency_is_deprecated
+ assert_deprecated('ActiveRecord::Base.allow_concurrency') do
+ ActiveRecord::Base.allow_concurrency
+ end
+ assert_deprecated('ActiveRecord::Base.allow_concurrency=') do
+ ActiveRecord::Base.allow_concurrency = true
end
- end
-
- def test_threaded_connections
- gather_connections
- assert_equal @connections.length, 5
end
end
class PooledConnectionsTest < ActiveRecord::TestCase
def setup
@connection = ActiveRecord::Base.remove_connection
- @allow_concurrency = ActiveRecord::Base.allow_concurrency
- ActiveRecord::Base.allow_concurrency = true
end
def teardown
ActiveRecord::Base.clear_all_connections!
- ActiveRecord::Base.allow_concurrency = @allow_concurrency
ActiveRecord::Base.establish_connection(@connection)
end
diff --git a/activerecord/test/cases/transactions_test.rb b/activerecord/test/cases/transactions_test.rb
index af3ee6ddba..8383ba58e9 100644
--- a/activerecord/test/cases/transactions_test.rb
+++ b/activerecord/test/cases/transactions_test.rb
@@ -283,17 +283,6 @@ end
if current_adapter?(:PostgreSQLAdapter)
class ConcurrentTransactionTest < TransactionTest
- def setup
- @allow_concurrency = ActiveRecord::Base.allow_concurrency
- ActiveRecord::Base.allow_concurrency = true
- super
- end
-
- def teardown
- super
- ActiveRecord::Base.allow_concurrency = @allow_concurrency
- end
-
# This will cause transactions to overlap and fail unless they are performed on
# separate database connections.
def test_transaction_per_thread