[rspec-users] Mock Global method

garren garren.smith at gmail.com
Tue Mar 23 16:12:22 EDT 2010

Hi All,

I'm very new to ruby and mocking a dynamic language. I would like to
mock a helper method in Sinatra. So an example is this:

   helper do
    def my_helper_method
      puts "Should do something useful here..."

How would I mock that method and how would I mock a method in general
that is a global method. Is it better practice not to have global
methods? Should I rather have an object inside the method call that
does all the work and I can mock that?


More information about the rspec-users mailing list