diff options
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/associations/has_one_associations_test.rb | 9 | ||||
-rw-r--r-- | activerecord/test/cases/associations_test.rb | 12 | ||||
-rw-r--r-- | activerecord/test/cases/attribute_methods_test.rb | 8 | ||||
-rw-r--r-- | activerecord/test/cases/base_test.rb | 7 | ||||
-rw-r--r-- | activerecord/test/cases/json_serialization_test.rb | 9 | ||||
-rw-r--r-- | activerecord/test/cases/reflection_test.rb | 7 |
6 files changed, 17 insertions, 35 deletions
diff --git a/activerecord/test/cases/associations/has_one_associations_test.rb b/activerecord/test/cases/associations/has_one_associations_test.rb index f3bf5baa95..299688d840 100644 --- a/activerecord/test/cases/associations/has_one_associations_test.rb +++ b/activerecord/test/cases/associations/has_one_associations_test.rb @@ -370,15 +370,6 @@ class HasOneAssociationsTest < ActiveRecord::TestCase assert_nil new_ship.pirate_id end - def test_deprecated_association_loaded - firm = companies(:first_firm) - firm.association(:account).stubs(:loaded?).returns(stub) - - assert_deprecated do - assert_equal firm.association(:account).loaded?, firm.account_loaded? - end - end - def test_association_keys_bypass_attribute_protection car = Car.create(:name => 'honda') diff --git a/activerecord/test/cases/associations_test.rb b/activerecord/test/cases/associations_test.rb index 38d439d68a..49d82ba2df 100644 --- a/activerecord/test/cases/associations_test.rb +++ b/activerecord/test/cases/associations_test.rb @@ -203,18 +203,6 @@ class AssociationProxyTest < ActiveRecord::TestCase assert_equal david.projects, david.projects.reload.reload end end - - # Tests that proxy_owner, proxy_target and proxy_reflection are implement as deprecated methods - def test_proxy_deprecations - david = developers(:david) - david.projects.load_target - - [:owner, :target, :reflection].each do |name| - assert_deprecated do - assert_equal david.association(:projects).send(name), david.projects.send("proxy_#{name}") - end - end - end end class OverridingAssociationsTest < ActiveRecord::TestCase diff --git a/activerecord/test/cases/attribute_methods_test.rb b/activerecord/test/cases/attribute_methods_test.rb index 5074ae50ab..54c4d4ae90 100644 --- a/activerecord/test/cases/attribute_methods_test.rb +++ b/activerecord/test/cases/attribute_methods_test.rb @@ -109,6 +109,14 @@ class AttributeMethodsTest < ActiveRecord::TestCase assert_respond_to topic, :title end + # IRB inspects the return value of "MyModel.allocate" + # by inspecting it. + def test_allocated_object_can_be_inspected + topic = Topic.allocate + assert_nothing_raised { topic.inspect } + assert topic.inspect, "#<Topic not initialized>" + end + def test_array_content topic = Topic.new topic.content = %w( one two three ) diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index 87ce537e0e..39043447fc 100644 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -502,13 +502,6 @@ class BasicsTest < ActiveRecord::TestCase assert_equal 'value2', weird.send('a$b') end - def test_attributes_guard_protected_attributes_is_deprecated - attributes = { "title" => "An amazing title" } - post = ProtectedTitlePost.new - assert_deprecated { post.send(:attributes=, attributes, false) } - assert_equal "An amazing title", post.title - end - def test_multiparameter_attributes_on_date attributes = { "last_read(1i)" => "2004", "last_read(2i)" => "6", "last_read(3i)" => "24" } topic = Topic.find(1) diff --git a/activerecord/test/cases/json_serialization_test.rb b/activerecord/test/cases/json_serialization_test.rb index 8664d63e8f..d9e350abc0 100644 --- a/activerecord/test/cases/json_serialization_test.rb +++ b/activerecord/test/cases/json_serialization_test.rb @@ -161,6 +161,15 @@ class DatabaseConnectedJsonEncodingTest < ActiveRecord::TestCase assert_match %r{"tag":\{"name":"General"\}}, json end + def test_includes_doesnt_merge_opts_from_base + json = @david.to_json( + :only => :id, + :include => :posts + ) + + assert_match %{"title":"Welcome to the weblog"}, json + end + def test_should_not_call_methods_on_associations_that_dont_respond def @david.favorite_quote; "Constraints are liberating"; end json = @david.to_json(:include => :posts, :methods => :favorite_quote) diff --git a/activerecord/test/cases/reflection_test.rb b/activerecord/test/cases/reflection_test.rb index 7e4ae1ea8d..58c78ab058 100644 --- a/activerecord/test/cases/reflection_test.rb +++ b/activerecord/test/cases/reflection_test.rb @@ -304,13 +304,6 @@ class ReflectionTest < ActiveRecord::TestCase assert_equal "category_id", Post.reflect_on_association(:categorizations).foreign_key.to_s end - def test_primary_key_name - assert_deprecated do - assert_equal "author_id", Author.reflect_on_association(:posts).primary_key_name.to_s - assert_equal "category_id", Post.reflect_on_association(:categorizations).primary_key_name.to_s - end - end - private def assert_reflection(klass, association, options) assert reflection = klass.reflect_on_association(association) |