aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-06-09 16:22:06 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-06-09 16:22:06 -0300
commit14ecc5ef11812d7d528f0e4ca51f704b07404a97 (patch)
tree6a56a60fe869552a7a5c6b738273c496efc17eb3 /activerecord/test
parentddb0b4a474de99fa8474e2111a05dd4bba7c6f0e (diff)
parentbc769581c20e5634debd18a9f6abfadb778e1ac6 (diff)
downloadrails-14ecc5ef11812d7d528f0e4ca51f704b07404a97.tar.gz
rails-14ecc5ef11812d7d528f0e4ca51f704b07404a97.tar.bz2
rails-14ecc5ef11812d7d528f0e4ca51f704b07404a97.zip
Merge pull request #15587 from sgrif/sg-remove-workaround
Remove workaround for non-lazy serialize in tests
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/adapters/postgresql/hstore_test.rb23
1 files changed, 8 insertions, 15 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/hstore_test.rb b/activerecord/test/cases/adapters/postgresql/hstore_test.rb
index 0b8c9fc052..3aac23a193 100644
--- a/activerecord/test/cases/adapters/postgresql/hstore_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/hstore_test.rb
@@ -296,24 +296,18 @@ class PostgresqlHstoreTest < ActiveRecord::TestCase
assert_equal({ }, hstore.reload.tags)
end
- # FIXME: remove this lambda once `serialize` no longer issues a db connection.
- LAZY_MODELS = lambda do
- return if defined?(TagCollection)
-
- class TagCollection
- def initialize(hash); @hash = hash end
- def to_hash; @hash end
- def self.load(hash); new(hash) end
- def self.dump(object); object.to_hash end
- end
+ class TagCollection
+ def initialize(hash); @hash = hash end
+ def to_hash; @hash end
+ def self.load(hash); new(hash) end
+ def self.dump(object); object.to_hash end
+ end
- class HstoreWithSerialize < Hstore
- serialize :tags, TagCollection
- end
+ class HstoreWithSerialize < Hstore
+ serialize :tags, TagCollection
end
def test_hstore_with_serialized_attributes
- LAZY_MODELS.call
HstoreWithSerialize.create! tags: TagCollection.new({"one" => "two"})
record = HstoreWithSerialize.first
assert_instance_of TagCollection, record.tags
@@ -324,7 +318,6 @@ class PostgresqlHstoreTest < ActiveRecord::TestCase
end
def test_clone_hstore_with_serialized_attributes
- LAZY_MODELS.call
HstoreWithSerialize.create! tags: TagCollection.new({"one" => "two"})
record = HstoreWithSerialize.first
dupe = record.dup