From 55bccde91e3d9959508ebcdc10e27eb45ac401ea Mon Sep 17 00:00:00 2001 From: James Mead Date: Thu, 24 Aug 2017 22:30:45 +0000 Subject: [PATCH] Fix deprecation warning for assert_nil in ClassMethodTest These unit tests are pretty horrible and this one in particular didn't seem to be testing anything useful. The fix makes it test the `ClassMethod#mock` slightly more convincingly and avoids the deprecation warning. Fixes #308. --- test/unit/class_method_test.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/unit/class_method_test.rb b/test/unit/class_method_test.rb index f2280f5d7..661a960b5 100644 --- a/test/unit/class_method_test.rb +++ b/test/unit/class_method_test.rb @@ -179,10 +179,9 @@ def test_should_call_stubbee_reset_mocha_if_no_expectations_remaining def test_should_return_mock_for_stubbee mocha = Object.new stubbee = Object.new - stubbee.define_instance_accessor(:mocha) { mocha } - stubbee.mocha = nil + stubbee.define_instance_method(:mocha) { mocha } method = ClassMethod.new(stubbee, :method_name) - assert_equal stubbee.mocha, method.mock + assert_equal mocha, method.mock end def test_should_not_match_if_other_object_has_a_different_class