diff options
author | Yves Senn <yves.senn@gmail.com> | 2016-07-27 08:20:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-27 08:20:22 +0200 |
commit | d0f8061cae576f7bdb89b2bceaf999b511403a3a (patch) | |
tree | da5d46b4eed23ef270ed564dab4e4d0affa0c047 /activerecord/test | |
parent | 1a2f1c48bdeda5df88e8031fe51943527ebc381e (diff) | |
parent | a3a6d74c7774fc9f5df4f171bf6e7926c77fbe64 (diff) | |
download | rails-d0f8061cae576f7bdb89b2bceaf999b511403a3a.tar.gz rails-d0f8061cae576f7bdb89b2bceaf999b511403a3a.tar.bz2 rails-d0f8061cae576f7bdb89b2bceaf999b511403a3a.zip |
Merge pull request #25408 from kamipo/should_not_reuse_quoted_true
Quoting booleans should return a frozen string
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/quoting_test.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/activerecord/test/cases/quoting_test.rb b/activerecord/test/cases/quoting_test.rb index c01c82f4f5..225e23bc83 100644 --- a/activerecord/test/cases/quoting_test.rb +++ b/activerecord/test/cases/quoting_test.rb @@ -149,5 +149,21 @@ module ActiveRecord assert_equal "1800", @quoter.quote(30.minutes) end end + + class QuoteBooleanTest < ActiveRecord::TestCase + def setup + @connection = ActiveRecord::Base.connection + end + + def test_quote_returns_frozen_string + assert_predicate @connection.quote(true), :frozen? + assert_predicate @connection.quote(false), :frozen? + end + + def test_type_cast_returns_frozen_value + assert_predicate @connection.type_cast(true), :frozen? + assert_predicate @connection.type_cast(false), :frozen? + end + end end end |