[rspec-users] "they" synonym for "it"?
work at ashleymoran.me.uk
Wed Jul 11 11:06:11 EDT 2007
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
GIVEN="a cow", WHEN="prodded with a stick", THEN="moo"
and turn it into this code:
describe Cow do
@cow = Cow.new
it 'should say "moo" when sent prod_with_stick' do
@cow.prod_with_stick.should == "moo"
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).
More information about the rspec-users