-1

As per sinatra documentation, we use configure block to run something once at startup. http://sinatrarb.com/intro.html

Consider, the below configure where I am fetching the credentials using Creds class and setting to creds.

configure do
    # setting at startup
    set :creds, Creds.fetch_creds
  end

While writing the unit tests using mocha, how can I stub this fetch_creds method? Please guide.

Vega
  • 27,856
  • 27
  • 95
  • 103
Raunak Kapoor
  • 731
  • 6
  • 14

1 Answers1

0

You can do that:

Creds.stubs(:fetch_creds)

https://github.com/freerange/mocha/#usage

sidney
  • 1,241
  • 15
  • 32