How to spy on method calls in minitest
You can spy on a method in minitest with a Mock by calling #verify
mock = MiniTest::Mock.new
mock.expect :username
User.stub :find, mock do
user = User.find(1)
user.username
end
mock.verify
You can spy on a method in minitest with a Mock by calling #verify
mock = MiniTest::Mock.new
mock.expect :username
User.stub :find, mock do
user = User.find(1)
user.username
end
mock.verify