March 14th, 2009
Better late than never:
[david: rspec (master)]$ multiruby -S rake spec ... Passed: v1_8_6_114, 1.8.7-p72, 1.9.1-p0
[david: example_rails_app (master)] $ multiruby -S rake rspec:pre_commit ... Passed: v1_8_6_114, 1.8.7-p72, 1.9.1-p0
Coming soon to a gem release near you.
February 25th, 2009
If you haven’t purchased the beta book yet, now is a great time to join the party! We just added three new chapters:
This is the next chapter in the Mastermind tutorial, which takes you through the evolution of a command line version of the classic Mastermind board game. The earlier chapters introduce RSpec and Cucumber. This new chapter introduces Cucumber’s new Scenario Outlines feature, which let’s you express repetitive scenarios in FIT-inspired tabular format.
Simulating the Browser with Webrat
Zach Dennis shows you how to write RSpec code examples for Rails views. Using Webrat’s
have_selector matchers, and wrapping them in custom matchers targetted at your app, Zach shows you how to provide value throughout the life of the application with expressive, maintainable view specs.
Chapters from Beta 1.0
These new chapters build on the chapters we already released in Beta 1.0:
- Describing Application Behaviour with Cucumber
- Working from the Outside-In with RSpec
- Code Examples
- RSpec and Test::Unit
- Tools and Integration
- BDD in Rails
- Cucumber with Rails
We’ve got many more chapters coming over the next two or three updates, including chapters from Dan North and Dave Astels on Behaviour Driven Development and Mock Objects, new material on integrating Selenium, extending and customizing RSpec, and much, much more.
Thanks to all who are already participating in the beta program. We’ve gotten some great feedback so far. Some of it is already incorporated in the 2.0 beta release, and much more will be addressed in the upcoming releases. You’re all making this a better book for everyone else who will read it, so thank you, thank you, thank you.
February 13th, 2009
Thank you to all who are participating in The RSpec Book beta program. We’ve already gotten some good feedback, and we look forward to more as we release updates over the coming weeks.
For those of you who are reading the beta and would like to provide feedback, there are two outlets for you on the Pragmatic Programmers’ site.
The errata page is for technical errors, typos, etc. Things that don’t really require any discussion and are simple, task oriented fixes.
Although the errata page lists Suggestion as a type of errata, the system provides no opportunity for a conversation. Therefore, if you are making a comment like “I’m not sure I agree with the statement on page 37” or “you say x here and y there, which is it?”, etc, then the forum might be a better option. That way I (or any of the authors) can throw questions back at you to get a better feel for what you’d like to see and how it might help.
Of course, we’d rather have your feedback than not, so if you’re not interested in such a dialog, go ahead and stick to the one-way-street of the errata page.
Again, thanks for the feedback thus far. You’re helping to make this a better book for everyone else who will read it.
January 29th, 2009
I’m pleased to announce the beta release of the Pragmatic Bookshelf’s The RSpec Book: Behaviour Driven Development with RSpec, Cucumber and Friends!
It’s been a long time coming, and there’s still a lot of work to do to get to print. The beta release has 9 of the 22 chapters we have planned. Most of what remains is almost done, but not quite ready to release yet. As with all of the Pragmatic beta books, we’ll do regular updates every few weeks as we wrap up the remaining chapters and incorporate your feedback. And please do provide feedback. We want this book to serve you well!
There are six authors involved: Dave Astels, Zach Dennis, Aslak Hellesøy, Bryan Helmkamp, Dan North, and me. I’m honored to be in such good company here, with the guys who brought us BDD, to the developers and maintainers of RSpec, Cucumber and Webrat.
You can read more (and buy the book!) at http://www.pragprog.com/titles/achbd/the-rspec-book
On behalf of all the authors, I’d like to extend a special thank you to all of you who have contributed to the software and the conversation around RSpec, Cucumber, and BDD in general. RSpec would be nothing without the community that has evolved around it, so thank you, thank you, thank you!
January 13th, 2009
Cucumber is the new Story Runner
rspec-1.1.12 is the last release that will ship with the Story Runner bundled. With the next release, we will do the one and only gem release of repo so you won’t be forced to upgrade to Cucumber Thanks to Chad Humphries for stepping in and extracting the Story Runner to a separate repo.
The Story Runner is deprecated, however, and we will not be maintaining it. If anybody wants to maintain it, you’re welcome to. Just fork the repo and have at it.
Why are we deprecating the Story Runner? Because Aslak Hellesøy’s Cucumber library kicks its ass. Easier setup means lower barrier to entry, building on treetop means great feedback with backtraces plus support for an ever-growing list of written languages. And migrating from RSpec Stories is a snap. So what are you waiting for?
January 4th, 2009
I’m getting ready to do a 1.1.12 release of rspec and rspec-rails. Given the history of release-related compatibility problems, I offer you release candidate gems, which you can acquire thusly:
UPDATE: new version (184.108.40.206) fixes dependency problem w/ github gems
gem sources --add http://gems.github.com [sudo] gem install dchelimsky-rspec -v 220.127.116.11 [sudo] gem install dchelimsky-rspec-rails -v 18.104.22.168
Release notes can be seen under Maintenance at:
NOTE: This will be the last release of rspec-rails that supports rails < 2.0
If you are so inclined, please grab these gems, use them, and let me know if there are any problems.
October 13th, 2008
I’m preparing to present a practical demonstration of rspec, cucumber and friends at Rails Summit Latin America this Thursday.
<p>I was playing with the idea of using cucumber/rspec to drive the development of a cucumber browser/editor, but I’ve decided that it ends up being a bit too meta for a conference presentation.</p> <p>Of course, nothing is too meta for a blog post, and clearly I’ve already procrastinated a great deal if it’s just a few days before and I’m still prototyping the app, so why not take some more time away from what I should be doing and post this sillyness?</p> <p>And with <strong>that</strong> ... enjoy!</p>
Feature: create feature
So that I can easily create new feature As a stakeholder I want to create a feature in a browser
Scenario: create feature When I create a new feature named "Eat Cheese" And I give "Eat Cheese" the narrative: So that I can be happy As a cheese-loving person I want to eat cheese And I add a scenario to "Eat Cheese" named "roquefort" And I add a step to "roquefort" with "Given I am holding my nose" And I add a step to "roquefort" with "When I eat a hunk o' roquefort" And I add a step to "roquefort" with "Then I should smile at its deliciousness"
And I save and run the "roquefort" scenario Then I should see "3 steps pending" And I should see: You can use these snippets to implement pending steps: Given /^I am holding my nose$/ do end When /^I eat a hunk o' roquefort$/ do end Then /^I should smile at its deliciousness$/ do end
DISCLAIMER: This also assumes some support for multi-line steps that has not yet been implemented and may not be supported as depicted here. So please don’t try this at home.
September 23rd, 2008
This past weekend, I presented on BDD and RSpec at the first annual Windy City Rails Conf. As is typical, I ran out of time and didn’t get to get down to details. My next talks are starting w/ code examples!
<p>Until then, here are the <a href="/assets/2008/9/23/BehaviourDrivenRails.WindyCityRails.2008.pdf">slides from the presentation</a>.</p>
September 22nd, 2008
Aslak Hellesøy’s Cucumber library will be replacing RSpec’s Story Runner after the RSpec 1.1.5 release (coming soon).
<p>Cucumber is a bottom up re-write of the Story Runner, and features a grammar parser using <a href="http://treetop.rubyforge.org/">Treetop</a>. When I first started working on support for plain text stories, I chose to roll my own parsing rather than writing a grammar for a number of reasons, but it turns out that we get some great benefits from it.</p> <h3>Cucumber supports multiple spoken languages:</h3> <p>So now you can say:</p>
Funcionalidade: Adição Para evitar erros bobos Como um péssimo matemático Eu quero saber como somar dois números
Cenário: Adicionar dois números Dado que eu digitei 50 na calculadora E que eu digitei 70 na calculadora Quando eu aperto o botão de soma Então o resultado na calculadora deve ser 120
Que legal! (How cool is that?)
<p>There are already several languages supported, and adding new ones is fairly trivial, so we’ll likely support adding your own languages after some time.</p> <h3>Improved backtraces</h3> <p>Cucumber includes line numbers from the plain text Feature files, making it much, much easier to understand failures. (NOTE: we’re calling them Features now instead of Stories – look for another post on that subject soon)</p> <h3>Simpler configuration</h3> <p>Cucumber eliminates steps_for and using_steps_for. Simply define steps using the Given, When and Then methods:</p>
Given /I have \$(\d+) in my (.*) account/ do |dollars, account_type| ... end
Now require the files with the step definitions you need:
cucumber -r features/steps/accounts.rb features/transfer_money
… and you’re off. For most cases you don’t even need that granularity, you can just say …
<pre><code>cucumber features</code></pre> <p>... and cucumber will require any .rb files it finds in the features directory before running the feature files.</p> <h3>Fewer surprises</h3> <p>When RSpec’s Story Runner finds more than one step definition that can handle a step, the first one it finds wins. This can lead to some painful debugging sessions.</p> <p>When Cucumber finds more than one step definition that can handle a step, you get an error telling you which step definitions are competing, including their location (file and line number), so you can easily see and resolve the conflict.</p> <h3>What this means for you if you’re already using Story Runner</h3> <p>Cucumber is only a few months old and is nearly feature compatible with RSpec’s Story Runner and already adds a lot of powerful new features. Aslak has converted many, many stories to cucumber features, and is <a href="http://github.com/aslakhellesoy/cucumber/wikis/migration-from-rspec-stories">posting about his experiences</a> and refining the process as he goes. By the time we release cucumber as the official scenario runner, the migration path will be well documented and inexpensive.</p> <p>As for a time frame, that’s difficult to say. We’ve been promising the 1.1.5 release for some time and for one reason or another it keeps getting pushed back. We’ll likely wait for the rails 2.2 release and make sure that it is compatible. Rumor has it that is coming soon, but it was coming soon several weeks ago as well, so we’ll have to wait and see.</p> <p>In the mean time, we are freezing development on Story Runner so that we can focus on Cucumber development. Before we officially release cucumber as part of rspec, we’ll create a separate project up on github for just the story runner (likely named rspec-stories) so the code will be available for teams that want to continue to use and/or maintain it.</p> <p>I’ll follow up here and on the <a href="http://rubyforge.org/mailman/listinfo/rspec-users">rspec-users mailing list</a> (which is mirrored by the <a href="http://groups.google.com/group/rspec">rspec google group</a>) as things progress.</p>
July 1st, 2008
Tagged by Bryan Helmkamp.
How old were you when you started programming?
Mid 20’s for a minute. Then mid 30’s for real.
How did you get started programming?
There were two starts. First, a tiny bit of background.
My father was a programmer for a minute (great stories about tripping on the way to deliver his final project in school, punch cards flying through the air in every-which direction), and my step father worked for Chemical Bank’s Data Processing department during my childhood. So I had some exposure to the results of programming as a kid, but had never really looked at any code. I was too busy shuffling cards and making coins disappear (my middle name, dare I admit it, is Arthur).
At 23, I was getting started as a musician (my 2nd career) and sought a non-music gig to get me through. A friend hooked me up as the copy-room attendent at an engineering firm. Apparently, this job had been occupied by people even less responsible that I was (a tough thing to be next to me at that age) because everyone was shocked when a couple of weeks in I was done each day by early afternoon and offering to help in other areas the rest of the day.
That’s when the guy who ran IT gave me the keys to the castle: a user account on their DIGITAL network and access to the giant BASIC manuals. I read through them in my spare time and wrote my first program: a musical scale generator. It went something like this:
$ What root? D $ What quality? minor $ D E F G A Bb C D $ What root?
Dig the simple UI! I got it to handle major, natural, harmonic and melodic minor scales and all the modes of each. I was quite proud.
Eventually I made the ill-fated, romantic decision to earn all of my pennies from musical endeavors, so I quit at the engineering firm, turning in my keys to the castle, and started teaching guitar to fill that hole in my pocket.
Skip ahead 10 or 15 years. By then (1998) had a degree in music and was earning a living playing, teaching and arranging music. You’ve heard this story before. All the money came from gigs that involved tuxedos or commercials, and I got through those gigs to sponsor my habit of playing jazz and rock in clubs for beer money.
During this time, I had acquired an Apple Performa (remember?), had figured out how to make simple html websites and was helping some musician friends with theirs. I really, really enjoyed this, and my girlfriend noticed that I smiled when I made a website or played Windows (unfortunately titled, but beautiful tune by Chick Corea) but I frowned when I played Celebration. She suggested that I should consider taking a programming course and trying to get a part time job somewhere, thus sponsoring the smiley parts of my music habit with something that also made me smile.
This was the late 90’s, smack in the middle of the bubble, and it seemed like a perfectly reasonable idea. Little did I know that 10 years later I’d have hung my guitars in the closet to work on OSS. They’re still hanging there. This makes me sad. But I haven’t sold them yet, so there is still hope.
Anyhow, I took a couple of classes at a local community college, got a job working in the school’s IT department, and here we are 10 years later.
What was your first language?
What was the first real program you wrote?
Depends on your definition of real. I wrote an applet when I was in school that let you try to solve a brain teaser. The first thing I got paid money to write that actually got used by people to make other money was an online training course for hospital administrators to learn how to fill out government forms properly.
What languages have you used since you started programming?
What was your first professional programming gig?
The aforementioned hospital admin training course.
If there is one thing you learned along the way that you would tell new developers, what would it be?
Best practices are the serpent. They have the potential to be useful, but they are only useful in a very limited set of contexts, and they are applied just as often (if not more often) in the wrong ones as the right ones. Take the blinders off.
What’s the most fun you’ve ever had programming?
Working on an accounting-support system for a non-profit. This was about a year long project. We were doing (mostly) XP, pairing, and working closely with the people who actually used the software. The team included Micah Martin, Paul Pagel and Craig Demyanovich, all three of whom contributed to pairing sessions filled with a great balance of joy and head-butting. I learned a ton and had a great time doing it.
Aside from the fun we had programming, there were a lot of fun non-programming moments as well. I think my favorite on that gig was one morning when we were all arriving at the office. We had started greeting each other in different languages, Micah in French, me in Portuguese, and Christine (a woman who was not on the team, but worked close by) in Italian. Craig had joined us for the first time since we had been doing this, and he caught on rather quickly:
Me: bom dia, gente!
Micah: bon jour!
Craig: puts “hello”
Another great moment on that project was sitting down with a user and watching her do her data entry job. She was really, really, really fast. But there was this one part in the process where she would pause for each entry. She wasn’t even aware of it, but recognized the problem when I brought it to her attention. So we made a small change to the UI and got rid of this small, but meaningful impediment and her life got just a little better. Very satisfying.
Here are some folks who don’t seem to have been tagged yet. Let’s see if they’ll play …