David Chelimsky

random thoughtlessness

Welcome Chad Humphries

| Comments

I’d like to welcome Chad Humphries to the Rspec Development Team.

Chad wrote an Rspec-compatible framework named Micronaut, which runs specs written for Rspec. With Chad on board, we’re replacing Rspec’s runner with Micronaut’s runner for rspec-2.0, which is already in progress and should be released with a new rspec-rails-2.0 plugin/gem in time for the Rails 3.0 release.

Check back here for more details over the coming days, but in the mean time:

Welcome, Chad!

get off (the couch) with me

| Comments

As Chad Fowler points out in his blog about the unofficial rubyconf 5k, the whole idea was born out of a conversation he and I were having about his new running habit, and how I’d been trying to get back into running for years and never had the right motivation. Well, there is little motivation to get back into it than helping to organize a 5k!

I just started back a little over a week ago and, this week, started the couch to 5k schedule. For those of you who have never run, or haven’t run in years, this schedule is absolutely fantastic.

It starts off with with alternating intervals of jogging for a minute and walking for 1.5 minutes for a total of 20 minutes. I immediately found that I was pushing much harder than normal for me during the 1 minute jogs, and after the 20 minutes I felt great! One week into this and I’m already jogging 8 minutes (sure, not in a row, but 8 minutes the 2nd week off the couch!).

Today I dragged my girlfriend along (she’s planning to run a 5k with me on Thanksgiving morning). Flor exercises regularly, but she is not a runner, yet she had no problem keeping up with me for these short intervals.

Of course I’m only a week into the schedule, and I’m sure it will get more challenging as the intervals get longer, but I’m pretty confident I’ll be able to keep up with the gradually increasing intensity.

So I encourage any of you who are attending RubyConf (or JRubyConf) to join us. We’ll have a website up with information and registration in a few weeks, but today is the day to start training! See you at the starting line!

The RSpec Book – Beta 10 and Progress Report

| Comments

Beta 10????? When the hell are we going to start chopping down some trees? Well, first, here’s what’s new in Beta 10 of The RSpec Book:

Automating the Browser with Webrat and Selenium

This new chapter from Bryan Helmkamp shows you how to drive Cucumber scenarios right through your browser using Webrat and Selenium. You’ll type a single command and watch a browser fire up and walk through each scenario step by step right before your very eyes, and then see a standard Cucumber report in the shell. It’s a sight to behold, and a great way to drive out behaviour that requires JavaScript.

And now, for your reading pleasure …

let it be @-less

| Comments

If you use RSpec and you’re disciplined about the red/green/refactor of Test Driven Development, you probably find yourself doing this from time to time. We start off with a single example:

describe BowlingGame do
it "scores all gutters with 0" do
  game = BowlingGame.new
  20.times { game.roll(0) }
  game.score.should == 0
end
end

Then add second example:

describe BowlingGame do
it "scores all gutters with 0" do
  game = BowlingGame.new
  20.times { game.roll(0) }
  game.score.should == 0
end

it "scores all 1's with 20" do
  game = BowlingGame.new
  20.times { game.roll(1) }
  game.score.should == 20
end
end

Once we get the second example passing, we remove duplication in the examples, typically like this:

describe BowlingGame do
before(:each) do
  @game = BowlingGame.new
end

it "scores all gutters with 0" do
  20.times { @game.roll(0) }
  @game.score.should == 0
end

it "scores all 1's with 20" do
  20.times { @game.roll(1) }
  @game.score.should == 20
end
end

This last step involves copying the first line of each example to a before(:each) block, and then converting the references to game to an instance variable using an @ symbol. This is tedious and error prone, but we accept that in the interest of keeping things clean.

rspec-1.2.9.rc1 and rspec-rails-1.2.9.rc1 have been released

| Comments

release candidates

We’re using the new rubygems prerelease feature to do proper release candidates. This feature was introduced to rubygems a couple of versions back, but I’d recommend updating to rubygems-1.3.5 before installing the rspec prerelease gems.

For those unfamiliar with this new rubygems feature, you have to add the —prerelease flag in order to see and install these gems:

$ gem search --remote --prerelease rspec

  *** REMOTE GEMS ***

  rspec (1.2.9.rc1)
  rspec-rails (1.2.9.rc1)

$ [sudo] gem install --prerelease rspec
$ [sudo] gem install --prerelease rspec-rails

This way only those who choose to install the prerelease gems will get them, while those who exclude the –prerelease flag will get the previous final release (rspec-1.2.8, rspec-rails-1.2.7.1).

Once you install the prerelease gems, Rubygems will treat 1.2.9.rc1 as a higher version than 1.2.8, but a lower version than 1.2.9. That way when we do the final release you’ll be able to just install 1.2.9 and it will take its rightful place ahead of 1.2.9.rc1 without you having to uninstall rc1.

Windy City Rails

| Comments

I’m presenting at Windy City Rails in September. This is just the second year of this exciting midwest Rails conference, but the schedule looks most impressive. Talks range from How To Test Absolutely Anything to Better Ruby through Functional Programming to a Rails 3 Update from Yehuda Katz, Rails core’s newest member and the man who is bringing the best of Merb to Rails 3.

Last year I did a presentation about BDD and, with such a wide subject, ran out of time before I got through most of it. This year, the organizers of the conference have given me the opportunity to talk for three full hours! Count ‘em. Three!

It’s actually not just me talking (whew!). It’s a tutorial entitled Behaviour Driven Rails with RSpec and Cucumber. I’m planning an intensive skills development workshop, taking attendees through the development of a feature in a Rails app from planning to writing Cucumber scenarios to driving out code with RSpec. This is going to be about as close as you’ll get to a BDD immersion in three hours, so I hope to see you there whether you’re just learning about BDD now or you’ve already been doing it for a while.

See you in September!

The RSpec Book: Beta 8.0

| Comments

The RSpec Book Beta 8.0 was just released. This release includes a number of fixed errata and one new chapter. Yes, only one chapter, but its a doozy:

Managing Complexity in Step Definitions

This chapter introduces a random generator to the Codebreaker game. This brings up several issues that can add complexity to Cucumber scenarios, RSpec code examples, and the code we’re driving out with the aid of these tools and the BDD process. We address these issues and offer strategies to manage the complexity they introduce.

The RSpec Book: Beta 6.0

| Comments

The RSpec Book Beta 6.0 was just released. This release includes a number of fixed errata, two new chapters, and a bit of re-organization.

Hello

We added a new chapter with basic install instructions and basic Hello Cucumber and Hello RSpec examples.

Rails Models

Covers writing model specs, validations, associations, mocks, test data builders and more.

Automating Features with Cucumber

We split Describing Features with Cucumber into two chapters: Describing Features with Cucumber and Automating Features with Cucumber. This allowed us to expand the material on planning the first release and iteration in the first chapter, and keep of the technical in the trenches material in the second.

Even if you’ve already read through the tutorial in previous beta releases, you’re going to want to re-read these two chapters.

Upgrading to ZenTest 4.1.0

| Comments

If you use Autotest with Ruby on Rails, be sure to gem install autotest-rails when you upgrade to ZenTest-4.1.0.

Without that gem, when you run the autospec command that ships with RSpec, Autotest won’t won’t have any way of knowing it’s in a Rails app and it will load up rspec’s autotest/rspec.rb instead of rspec-railsautotest/rails_rspec.rb.

Even if you’re not using RSpec, you’ll get ZenTest’s autotest/autotest.rb instead of autotest/rails.rb when you run the autotest command.

The next release of rspec-rails will include a patch to resolve this for RSpec users, but in the mean time (and for everybody else), just gem install autotest-rails and resume your regularly scheduled continuous testing.

The RSpec Book: Beta 5.0

| Comments

This release introduces two new chapters:

Writing Software that Matters

Having laid out the case for Behaviour Driven Development in The Case for BDD, this new chapter explores the principles and strategies that BDD brings to the Agile table.

Mock Objects

One of the most complex and controversial topics in developer testing is that of Mock Objects. In this new chapter, Mock Objects, we review some basic terminology and explore the underlying motivations for two essential tools in the BDD toolkit: test stubs and mock objects.