aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2018-06-06 13:17:53 -0400
committerGitHub <noreply@github.com>2018-06-06 13:17:53 -0400
commit86e42b53662f535ee484630144e27ee684e8e8dc (patch)
tree60675e63b94b8a8e8c7b50911abe1cfeca34b97a /activerecord/test
parent03eadaec4025490d2751ca96338602e701e0f52b (diff)
parent702b1768c425e7187ef4c62beb1ed12ed7774d83 (diff)
downloadrails-86e42b53662f535ee484630144e27ee684e8e8dc.tar.gz
rails-86e42b53662f535ee484630144e27ee684e8e8dc.tar.bz2
rails-86e42b53662f535ee484630144e27ee684e8e8dc.zip
Merge pull request #33067 from kamipo/fix_force_equality
Fix force equality checking not to break the serialized attribute with Array
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/serialized_attribute_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/serialized_attribute_test.rb b/activerecord/test/cases/serialized_attribute_test.rb
index 7764a37273..4cd4515c3b 100644
--- a/activerecord/test/cases/serialized_attribute_test.rb
+++ b/activerecord/test/cases/serialized_attribute_test.rb
@@ -159,6 +159,13 @@ class SerializedAttributeTest < ActiveRecord::TestCase
assert_equal(settings, Topic.find(topic.id).content)
end
+ def test_where_by_serialized_attribute_with_array
+ settings = [ "color" => "green" ]
+ Topic.serialize(:content, Array)
+ topic = Topic.create!(content: settings)
+ assert_equal topic, Topic.where(content: settings).take
+ end
+
def test_where_by_serialized_attribute_with_hash
settings = { "color" => "green" }
Topic.serialize(:content, Hash)