This post originated from an RSS feed registered with Ruby Buzz
by Andy Delcambre.
Original Post: Planet Argon and Rspec musings
Feed Title: Andy Delcambre
Feed URL: http://feeds.feedburner.com/andydelcambre
Feed Description: Andy has been using Ruby and Ruby on Rails since 2006 and has been working with Ruby on Rails professionally since June 2007.
Started work at Planet Argon today. I have been chatting with them for about 6 weeks, and I am extremely excited to start working with them. Today was pretty slow to start (as I expected), getting accounts going, getting mysql working properly on my laptop, getting subversion checkouts, etc, etc. Then I got started working on some actual coding.
I am starting out writing some specs for the project I am working on. I have used rspec for a few different projects but I hadn’t had a chance to play with the new syntax yet. It is basically exactly the same as when I used it just with different method names, but it really makes a huge difference in the style it forces you into.
With the old method, how to describe the specs was always a bit weird to me. For example:
context "a new group with no users" do
specify "group should not be valid" do
#...
end
end
With the new style everything seems to flow naturally. For example:
describe Group, " with no users" do
it "should not be valid" do
@group.should_not be_valid
end
end
Interesting is that I often feel like I write the same thing twice, once in english, then again in the DSL of rspec. But if you read them out loud, they are basically the same:
it "should have four elements"
@thing.should have(4).elements
I also often find that I can guess the right syntax which is HUGE for rapid development times. I really like rspec, and I think I am really going to like working for Planet Argon.