aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorRonak Jangir <ronakjangir47@gmail.com>2015-07-25 19:50:15 +0530
committerRonak Jangir <ronakjangir47@gmail.com>2015-08-13 08:32:35 +0530
commitbfe75328761bcbb7933dcf7714f6049c094b62dc (patch)
tree2c745ff53e02a6d735b0aeab7e262ec4acc54ae4 /activesupport/test
parent2117a535b5ab5d88ccb9834fa14b28863ffb69cc (diff)
downloadrails-bfe75328761bcbb7933dcf7714f6049c094b62dc.tar.gz
rails-bfe75328761bcbb7933dcf7714f6049c094b62dc.tar.bz2
rails-bfe75328761bcbb7933dcf7714f6049c094b62dc.zip
Added helper methods to stub any instance
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/testing/method_call_assertions_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/activesupport/test/testing/method_call_assertions_test.rb b/activesupport/test/testing/method_call_assertions_test.rb
index a9908aea0d..652cbda8da 100644
--- a/activesupport/test/testing/method_call_assertions_test.rb
+++ b/activesupport/test/testing/method_call_assertions_test.rb
@@ -95,4 +95,17 @@ class MethodCallAssertionsTest < ActiveSupport::TestCase
assert_equal "Expected increment to be called 0 times, but was called 1 times.\nExpected: 0\n Actual: 1", error.message
end
+
+ def test_stub_any_instance
+ stub_any_instance(Level) do |instance|
+ assert_equal instance, Level.new
+ end
+ end
+
+ def test_stub_any_instance_with_instance
+ stub_any_instance(Level, instance: @object) do |instance|
+ assert_equal @object, instance
+ assert_equal instance, Level.new
+ end
+ end
end