I have a Sinatra app like this:
my_module.rb
module MyModule
def my_method
"yay"
end
end
app.rb
get "/my_module" do
puts my_method
end
I'm trying to stub my_method
on a test with Minitest
and mocha
.
def test_my_method
MyModule.stubs(:my_method).returns("stubbed")
get "/my_module"
end
But this don't seems to work, because the original method is still called. Any thoughts on how to do this? Thanks!