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
When we think of interfaces, as traditional object-oriented programmers, the words 'abstract' or 'implements' come to mind and the example of the Shape Interface with the Rectangle and Triangle classes materialises before us; or the Animal interface with a Dog and Cat class mulling around. Go thinks differently and hence I take a different (and probably … Continue reading Go Interfaces and Quacking
Welcome to the world of mocks and stubs using minitest-rails. We see various helpful gems that help in mocking and stubbing.
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.
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