diff options
author | Ronak Jangir <ronakjangir47@gmail.com> | 2015-07-25 19:50:15 +0530 |
---|---|---|
committer | Ronak Jangir <ronakjangir47@gmail.com> | 2015-08-13 08:32:35 +0530 |
commit | bfe75328761bcbb7933dcf7714f6049c094b62dc (patch) | |
tree | 2c745ff53e02a6d735b0aeab7e262ec4acc54ae4 /activesupport/lib | |
parent | 2117a535b5ab5d88ccb9834fa14b28863ffb69cc (diff) | |
download | rails-bfe75328761bcbb7933dcf7714f6049c094b62dc.tar.gz rails-bfe75328761bcbb7933dcf7714f6049c094b62dc.tar.bz2 rails-bfe75328761bcbb7933dcf7714f6049c094b62dc.zip |
Added helper methods to stub any instance
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/testing/method_call_assertions.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/testing/method_call_assertions.rb b/activesupport/lib/active_support/testing/method_call_assertions.rb index e3cbe40308..517f02e3ef 100644 --- a/activesupport/lib/active_support/testing/method_call_assertions.rb +++ b/activesupport/lib/active_support/testing/method_call_assertions.rb @@ -30,6 +30,10 @@ module ActiveSupport def assert_not_called(object, method_name, message = nil, &block) assert_called(object, method_name, message, times: 0, &block) end + + def stub_any_instance(klass, instance: klass.new) + klass.stub(:new, instance) { yield instance } + end end end -end
\ No newline at end of file +end |