method

assert_called_with

Importance_0
v7.0.0 - Show latest stable - 0 notes - Class: MethodCallAssertions
assert_called_with(object, method_name, args, returns: nil, &block) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activesupport/lib/active_support/testing/method_call_assertions.rb, line 20
        def assert_called_with(object, method_name, args, returns: nil, &block)
          mock = Minitest::Mock.new

          if args.all?(Array)
            args.each { |arg| mock.expect(:call, returns, arg) }
          else
            mock.expect(:call, returns, args)
          end

          object.stub(method_name, mock, &block)

          mock.verify
        end
Register or log in to add new notes.