[rspec-users] given_it

lancecarlson at gmail.com lancecarlson at gmail.com
Fri Sep 21 16:14:22 EDT 2007

If you want to reuse stuff in your tests put those test methods in a separate module and include them into you specs
Sent via BlackBerry from T-Mobile

-----Original Message-----
From: Yurii Rashkovskii <yrashk at gmail.com>

Date: Fri, 21 Sep 2007 23:12:50 
To:rspec-users <rspec-users at rubyforge.org>
Subject: Re: [rspec-users] given_it

>> Sure! But they are not the same stuff. What I was looking for is
>> it "should do #1" do
>>   ...
>> end
>> it "should do X after #1" do
>>   given_it "should do #1"
>>   should do_x
>> end
>> it "should do Y after #1" do
>>   given_it "should do #1"
>>   should do_y
>> end
>> it "should do Z after #1 Y" do
>>   given_it "should do Y after #1"
>>   should do_z
>> end
> Sorry mate - that just seems like endless confusion - the examples
> should never rely on each other that way - different animal from
> scenarios that involve steps.

I agree that they should not rely on each other _indirectly_. But why  
they should not _reuse_ each other? I find it very useful for  
testing, say, different aspects of, say, controller's behavior. I  
simply do not want to put all checks into one example, like it should  
do this, this and this and in result we should have this, this and  
that. How do you propose to test different aspects of single actions  
in a nice way?
rspec-users mailing list
rspec-users at rubyforge.org

More information about the rspec-users mailing list