[rspec-users] testing controllers using cucumber
cwdinfo at gmail.com
Mon Feb 1 12:24:21 EST 2010
On Feb 1, 2010, at 1:30 AM, Amit Kulkarni wrote:
> Oh ok.
>> From your code it seems that we are checking the whole app as you
> I have tested controllers using rspec.
> So i am not getting which is better to use.
> Since with Rspec we test the objects and here using cucumber(good for
> writing scenarios and understanding)we are testing the GUI part(using
> So which is good to use and more effective
From my perspective, and this is just opinion, it depends on how granular you want your test and how fast it has to run. If you want to test the whole stack, then Cuke is great and it *will* exercise the controller. However, it does it more in the way a user might and can miss some edge cases. However, if you have a set of very specific behaviors like how a controller should respond to various mime types or what exceptions might be raised in certain circumstances, it might be better done using rSpec. Also, typically, a given rSpec test is faster because it doesn't have to load the whole Rails stack and you can mock or stub irrelevant parts.
Just my $.02.
More information about the rspec-users