RSpec group on LinkedIn

December 5th, 2008

I forgot to publicise this. A little while ago I created an RSpec group on LinkedIn. If you use RSpec or Cucumber for fun or profit, make sure to add yourself!

An easy one I just needed because I got sick of (a) waiting for long running features and (b) typing cucumber args by hand. Put this in your Rakefile:

1
2
3
4
5
6
7
8
9
10
11
12
13
14

require 'cucumber/rake/task'
 
Cucumber::Rake::Task.new do |t|
  t.cucumber_opts = "--format pretty"
end

Dir["features/**/*.feature"].each do |f|
  task_name = f.gsub("/descriptions/", "/").gsub("/", ":").gsub(".feature", "")
  Cucumber::Rake::Task.new(task_name) do |t|
    t.feature_pattern = f
    t.cucumber_opts = "--format pretty"
  end
end

Note: I keep my features in features/descriptions rather than straight in features, but the tasks generate sensibly in either case.

It won't scale to many files, at which point a per-directory task generator would be more useful.

This is the second part of installing a full Merb BDD stack. This time: Ruby, JRuby, Merb, RSpec, Cucumber, Celerity and TextMate bundles (the right way).

Read the rest of this entry