aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/attribute_methods_test.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2018-06-26 09:15:55 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2018-06-26 09:29:53 -0700
commit634c53ac0ec6e4036870d79783daa403bf46dad2 (patch)
tree8e7578fbdfce37efc39dd36fbc1604bd42d0bee8 /activerecord/test/cases/attribute_methods_test.rb
parentcc0e84f9bfa89750ceca38db47ce5657cc373c3d (diff)
downloadrails-634c53ac0ec6e4036870d79783daa403bf46dad2.tar.gz
rails-634c53ac0ec6e4036870d79783daa403bf46dad2.tar.bz2
rails-634c53ac0ec6e4036870d79783daa403bf46dad2.zip
Call initialize after allocate
If someone calls allocate on the object, they'd better also call an initialization routine too (you can't expect allocate to do any initialization work). Before this commit, AR objects that are instantiated from the database would call `define_attribute_methods` twice.
Diffstat (limited to 'activerecord/test/cases/attribute_methods_test.rb')
-rw-r--r--activerecord/test/cases/attribute_methods_test.rb13
1 files changed, 0 insertions, 13 deletions
diff --git a/activerecord/test/cases/attribute_methods_test.rb b/activerecord/test/cases/attribute_methods_test.rb
index 434d32846c..0bfd46a522 100644
--- a/activerecord/test/cases/attribute_methods_test.rb
+++ b/activerecord/test/cases/attribute_methods_test.rb
@@ -163,19 +163,6 @@ class AttributeMethodsTest < ActiveRecord::TestCase
assert_equal "10", keyboard.read_attribute_before_type_cast(:key_number)
end
- # Syck calls respond_to? before actually calling initialize.
- test "respond_to? with an allocated object" do
- klass = Class.new(ActiveRecord::Base) do
- self.table_name = "topics"
- end
-
- topic = klass.allocate
- assert_not_respond_to topic, "nothingness"
- assert_not_respond_to topic, :nothingness
- assert_respond_to topic, "title"
- assert_respond_to topic, :title
- end
-
# IRB inspects the return value of MyModel.allocate.
test "allocated objects can be inspected" do
topic = Topic.allocate