Rails Minitest: Mock controller method
setup do
  @controller.stubs(:doorkeeper_token).returns(token)
end
require 'minitest/autorun'

book = MiniTest::Mock.new
# Set the mock to expect :title, return "War and Piece"
# (note that unless we call book.verify, minitest will
# not check that :title was called)
book.expect :title, "War and Piece"

# Stub Book.new to return the mock object
# (only within the scope of the block)
Book.stub :new, book do
  wp = Book.new # returns the mock object
  wp.title      # => "War and Piece"
end