[rspec-users] Controller specs not shareable?

Ashley Moran work at ashleymoran.me.uk
Wed Jun 27 09:37:51 EDT 2007

On 27 Jun 2007, at 12:31, David Chelimsky wrote:

> Try this instead:
> describe "All XHR POSTs to /gap/calculate_quote", :shared => true do
>     # ...
> end

Aha yeah - it was the controller_name here that was making it fail

> describe GapController, "XHR POST /gap/calculate_quote with valid  
> details" do
>   it_should_behave_like "All XHR POSTs to /gap/calculate_quote"
>   # ...
> end
> The idea of shared behaviours is that multiple things that are being
> described have similar behaviour. The specific things, however, should
> never be created in the shared behaviour - they are the responsibility
> of the behaviours that should_behave_like them.
> Make sense?

Yep it does now.  I was thinking of shared behaviours as like an  
inheritance hierarchy but actually they're more like mixins, if I  
understand correctly.  ( They are ruby not java :D )

Thanks for the quick reply... can get on coding again now!


More information about the rspec-users mailing list