A Simple Go Web App on Heroku with MongoDB on MongoHQ

Go is an extremely clean and fun language to work with and has a bunch of handy, modular, well documented packages out of the box. We can easily build a small web app using pure Go for handler functions, the net/http library for routing and serving and mgo as a MongoDB driver. The simple Go … Continue reading A Simple Go Web App on Heroku with MongoDB on MongoHQ

Handy gems for minitest-rails part2

Welcome to the world of mocks and stubs using minitest-rails. We see various helpful gems that help in mocking and stubbing.

rails learning

Mocks and stubs are not new concepts that have been introduced in minitest. If you want to get detailed understanding about what are mocks and stubs you should read mocks aren’t stubs written by Martin Fowler. To achieve mocking and stubbing in minitest-rails you don’t need to include any separate gem like rspec-mocks in rspec. Let see how to do work with mocks and stubs in minitest then check what are gems available to add extra functionality.

Method stubbing
Stubbing a method means, set a pre-defined return value of a method in test-case. Let’s check how to do method stubbing in minitest:

In this example, I stub foo and check what would be the output of new_method. As matter of fact it won’t call actual foo method instead it calls stub foo method. Now that we have  seen how to stub and instance method, let check how to stub on…

View original post 275 more words