[rspec-users] extracting common methods out of specs

Tim Lucas t.lucas at toolmantim.com
Tue Mar 27 23:05:01 EDT 2007


On 28/03/2007, at 12:42 PM, Scott Taylor wrote:

>
> I have several specs which do more or less the same thing:
>
> describe "GET /users/1/terms" do
>    controller_name :terms
>
>    def do_get
>      get :index, :user_id => 1
>    end
>
>    it "should be successful" do
>      controller.should_render :index
>      do_get
>    end
>    ...
> end
>
>
> How could I extract this functionality from each spec?

but *should* you extract this functionality from each spec? Actions  
change in complexity so often, and so what might look common and  
repetitive now might end up differing quite significantly in a  
month's time.

-- tim



More information about the rspec-users mailing list