[rspec-users] "they" synonym for "it"?

Anthony Carlos anthony at digitalphenom.com
Wed Jul 11 12:12:52 EDT 2007

I think this is a nugget of experience about which it's worth  
shouting. I've read lots of articles about the theory behind BDD and  
TDD, but I need(ed) help learning how to phrase and write specs. That  
is, what to spec and how to write it; what is good style, and what is  
not so good. I'd love to come up with a guide like "The Elements of  
Style" by Strunk, White, et. al, which I used in college to really  
learn how to write.

Perhaps we need to bundle "The Elements of RSpec Style" with the  
documentation on the website. I'm happy to collect and edit suggestions.

What do you think?


On Jul 11, 2007, at 11:06 AM, Ashley Moran wrote:

> On 11 Jul 2007, at 15:00, Pedro Del Gallego wrote:
>>  Thats my biggest problem with rspec, (I'm a non english speaker
>> working in a German/English environment)  It would be great a  
>> guide or
>> a tips list to make our specs more  readebles, Something like 10
>> English tips to improve your specs readability ;)
> Don't think I can come up with 10 off the top of my head but I always
> told Pawel to follow the rule "phrase descriptions as GIVEN WHEN
> THEN".  There's plenty of better examples on this list and elsewhere,
> but basically if I have an idea like this:
>    A cow prodded with a stick should moo
> I think:
>    GIVEN="a cow", WHEN="prodded with a stick", THEN="moo"
> and turn it into this code:
>    describe Cow do
>      before(:each) do
>        @cow = Cow.new
>      end
>      it 'should say "moo" when sent prod_with_stick' do
>        @cow.prod_with_stick.should == "moo"
>      end
>    end
> It doesn't apply rigidly to every situation, but 90% of the time, if
> I keep chanting GIVEN WHEN THEN I write clean, focussed specs.  The
> rest is mainly vocabulary (although sometimes it can be hard to
> phrase something clearly).
> Ashley
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

More information about the rspec-users mailing list