aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorRonak Jangir <ronakjangir47@gmail.com>2015-08-15 17:38:18 +0530
committerRonak Jangir <ronakjangir47@gmail.com>2015-08-20 09:22:56 +0530
commit63a70ad6ff3223e20ae27c6738dc6bc7d2c6c11c (patch)
treee6f1a888252546c9de756706fe35716c97aba609 /activesupport/lib
parentc42db41f54adbcd981cbd4cc725e342fb3591176 (diff)
downloadrails-63a70ad6ff3223e20ae27c6738dc6bc7d2c6c11c.tar.gz
rails-63a70ad6ff3223e20ae27c6738dc6bc7d2c6c11c.tar.bz2
rails-63a70ad6ff3223e20ae27c6738dc6bc7d2c6c11c.zip
Cleaned up generators tests using internal assertion helper
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/testing/method_call_assertions.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/testing/method_call_assertions.rb b/activesupport/lib/active_support/testing/method_call_assertions.rb
index 155d3344d3..fccaa54f40 100644
--- a/activesupport/lib/active_support/testing/method_call_assertions.rb
+++ b/activesupport/lib/active_support/testing/method_call_assertions.rb
@@ -1,11 +1,13 @@
+require 'minitest/mock'
+
module ActiveSupport
module Testing
module MethodCallAssertions # :nodoc:
private
- def assert_called(object, method_name, message = nil, times: 1)
+ def assert_called(object, method_name, message = nil, times: 1, returns: nil)
times_called = 0
- object.stub(method_name, proc { times_called += 1 }) { yield }
+ object.stub(method_name, proc { times_called += 1; returns }) { yield }
error = "Expected #{method_name} to be called #{times} times, " \
"but was called #{times_called} times"