Hello and welcome to the restorm technical blog. It is here that we post about what is happening in our labs, what keeps us busy and why X doesn't work. Read more about us on the about page.

eliminate, stamp out and abolish redundancy - to hell with spec/mocks

Feb 12, 2008 | 0 comments

We firmly believe a testing framework should not also bring a mocking framework along. And we choose flexmock over the alternatives. Also – that choice was made before switching to rspec, so we weren’t at all happy with spec/mocks and flexmock battling themselves in our code.

The battle was inevitable, since both offer you convenience methods like

object.should_receive(:message)

Are you sure which framework you use in your rails specs? Really? Read on.

Ripping out spec/mocks

So you rip it out, right? No. Even though rspec allows you to configure mocking, rspec_on_rails will load and use the spec/mocks framework.

We selfishly rewrote rspec_on_rails into rspec_flexmock_on_rails. Branching is not always a good idea, but this time – it might just solve things for some people, that’s why we put our code in public under the same license that rspec is. Here goes:

http://swissrb.rubyforge.org/svn/rspec_flexmock_on_rails/

Please leave us a comment – if enough people start using this, we might be tempted to patch…

yours truly, kaspar