aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2017-07-21 17:48:00 -0400
committerGitHub <noreply@github.com>2017-07-21 17:48:00 -0400
commit8ec5c878fdb0eb326c56deea4405364a98d279b5 (patch)
tree3a408a3d42d7f688472f56d419f502a09598f69a /activerecord/test
parent81d7b9854fe017acc5861400ab7aa899e9edf010 (diff)
parent2ec207520389f4a6acb393be45bc73cc3815ad76 (diff)
downloadrails-8ec5c878fdb0eb326c56deea4405364a98d279b5.tar.gz
rails-8ec5c878fdb0eb326c56deea4405364a98d279b5.tar.bz2
rails-8ec5c878fdb0eb326c56deea4405364a98d279b5.zip
Merge pull request #29869 from kamipo/make_type_map_to_private
Make `type_map` to private because it is only used in the connection adapter
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/adapters/postgresql/composite_test.rb2
-rw-r--r--activerecord/test/cases/adapters/postgresql/type_lookup_test.rb12
-rw-r--r--activerecord/test/cases/connection_adapters/mysql_type_lookup_test.rb2
-rw-r--r--activerecord/test/cases/connection_adapters/type_lookup_test.rb6
-rw-r--r--activerecord/test/cases/query_cache_test.rb4
5 files changed, 12 insertions, 14 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/composite_test.rb b/activerecord/test/cases/adapters/postgresql/composite_test.rb
index 1d60a007c7..5da95f7e2c 100644
--- a/activerecord/test/cases/adapters/postgresql/composite_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/composite_test.rb
@@ -106,7 +106,7 @@ class PostgresqlCompositeWithCustomOIDTest < ActiveRecord::PostgreSQLTestCase
def setup
super
- @connection.type_map.register_type "full_address", FullAddressType.new
+ @connection.send(:type_map).register_type "full_address", FullAddressType.new
end
def test_column
diff --git a/activerecord/test/cases/adapters/postgresql/type_lookup_test.rb b/activerecord/test/cases/adapters/postgresql/type_lookup_test.rb
index 1a164205aa..449023b6eb 100644
--- a/activerecord/test/cases/adapters/postgresql/type_lookup_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/type_lookup_test.rb
@@ -8,16 +8,16 @@ class PostgresqlTypeLookupTest < ActiveRecord::PostgreSQLTestCase
end
test "array delimiters are looked up correctly" do
- box_array = @connection.type_map.lookup(1020)
- int_array = @connection.type_map.lookup(1007)
+ box_array = @connection.send(:type_map).lookup(1020)
+ int_array = @connection.send(:type_map).lookup(1007)
assert_equal ";", box_array.delimiter
assert_equal ",", int_array.delimiter
end
test "array types correctly respect registration of subtypes" do
- int_array = @connection.type_map.lookup(1007, -1, "integer[]")
- bigint_array = @connection.type_map.lookup(1016, -1, "bigint[]")
+ int_array = @connection.send(:type_map).lookup(1007, -1, "integer[]")
+ bigint_array = @connection.send(:type_map).lookup(1016, -1, "bigint[]")
big_array = [123456789123456789]
assert_raises(ActiveModel::RangeError) { int_array.serialize(big_array) }
@@ -25,8 +25,8 @@ class PostgresqlTypeLookupTest < ActiveRecord::PostgreSQLTestCase
end
test "range types correctly respect registration of subtypes" do
- int_range = @connection.type_map.lookup(3904, -1, "int4range")
- bigint_range = @connection.type_map.lookup(3926, -1, "int8range")
+ int_range = @connection.send(:type_map).lookup(3904, -1, "int4range")
+ bigint_range = @connection.send(:type_map).lookup(3926, -1, "int8range")
big_range = 0..123456789123456789
assert_raises(ActiveModel::RangeError) { int_range.serialize(big_range) }
diff --git a/activerecord/test/cases/connection_adapters/mysql_type_lookup_test.rb b/activerecord/test/cases/connection_adapters/mysql_type_lookup_test.rb
index 521879cc2f..7c41050eaa 100644
--- a/activerecord/test/cases/connection_adapters/mysql_type_lookup_test.rb
+++ b/activerecord/test/cases/connection_adapters/mysql_type_lookup_test.rb
@@ -49,7 +49,7 @@ if current_adapter?(:Mysql2Adapter)
private
def assert_lookup_type(type, lookup)
- cast_type = @connection.type_map.lookup(lookup)
+ cast_type = @connection.send(:type_map).lookup(lookup)
assert_equal type, cast_type.type
end
diff --git a/activerecord/test/cases/connection_adapters/type_lookup_test.rb b/activerecord/test/cases/connection_adapters/type_lookup_test.rb
index 1c4ca2e23d..917a04ebc3 100644
--- a/activerecord/test/cases/connection_adapters/type_lookup_test.rb
+++ b/activerecord/test/cases/connection_adapters/type_lookup_test.rb
@@ -82,7 +82,7 @@ unless current_adapter?(:PostgreSQLAdapter) # PostgreSQL does not use type strin
end
def test_bigint_limit
- cast_type = @connection.type_map.lookup("bigint")
+ cast_type = @connection.send(:type_map).lookup("bigint")
if current_adapter?(:OracleAdapter)
assert_equal 19, cast_type.limit
else
@@ -100,7 +100,7 @@ unless current_adapter?(:PostgreSQLAdapter) # PostgreSQL does not use type strin
{ decimal: %w{decimal(2) decimal(2,0) numeric(2) numeric(2,0) number(2) number(2,0)} }
end.each do |expected_type, types|
types.each do |type|
- cast_type = @connection.type_map.lookup(type)
+ cast_type = @connection.send(:type_map).lookup(type)
assert_equal expected_type, cast_type.type
assert_equal 2, cast_type.cast(2.1)
@@ -111,7 +111,7 @@ unless current_adapter?(:PostgreSQLAdapter) # PostgreSQL does not use type strin
private
def assert_lookup_type(type, lookup)
- cast_type = @connection.type_map.lookup(lookup)
+ cast_type = @connection.send(:type_map).lookup(lookup)
assert_equal type, cast_type.type
end
end
diff --git a/activerecord/test/cases/query_cache_test.rb b/activerecord/test/cases/query_cache_test.rb
index 3a2bd62997..f843368a09 100644
--- a/activerecord/test/cases/query_cache_test.rb
+++ b/activerecord/test/cases/query_cache_test.rb
@@ -402,10 +402,8 @@ class QueryCacheTest < ActiveRecord::TestCase
# Warm the cache
Task.find(1)
- Task.connection.type_map.clear
-
# Preload the type cache again (so we don't have those queries issued during our assertions)
- Task.connection.send(:initialize_type_map, Task.connection.type_map)
+ Task.connection.send(:reload_type_map)
# Clear places where type information is cached
Task.reset_column_information