[rspec-users] Command line story runner

Kyle Hargraves philodespotos at gmail.com
Thu Apr 3 10:58:09 EDT 2008

Hullo all,

It sucks to write wrapper .rb files just so stories/all.rb can find
and run them.

So I am trawling for feedback on a small project I pushed to github a
day or two ago; it provides a 'story' executable that can be used to
run your plain text stories from the command line, akin to the 'spec'
command. It's based on Bryan Helmkamp's script/story command that he
posted to this list --
-- and is still pretty much all his code.

The project is available on github at http://github.com/pd/story and
can be installed by cloning it, `rake gem`, then installing the gem in
pkg/whatever.gem. I won't be pushing a gem of this to rubyforge for a
while. The repository includes a brief readme detailing the features:

- Options can be specified in stories/story.opts, which is
automatically loaded if present (unlike spec, but I am too lazy to
type -O so often)
- Allows you to specify a single .story file, a directory full of
them, nothing at all to run ./stories/stories/**/*.story, etc.
- It works for both rails and non-rails projects, by allowing a
--rails option to specify that stories should be run as a RailsStory
- Step group definitions which should be accessible in every story can
be listed using --global-steps
- Deduces the default step groups to include by using the .story
file's pathname.
- Step groups to be included which could not be deduced from the story
filename can be listed at the top of the file, eg:
  # +steps: foo, bar/baz, and a really long step group name
- 'and a really long step group name' is a valid name; I prefer
strings to symbols here (tho symbols will still work). This allows the
story at stories/stories/foo/bar.story to include the 'foo/bar' step
group, and also permits step group names such as 'data creation'.

One achingly missing feature at the moment is hooking into the config
options for Spec::Story::Runner, but I didn't have any immediate use
for it so I didn't bother. But I will probably do so soon enough.
(Also, specs =)

This is very tied to the layout of my own projects, and I'd be
surprised if it works out of the box for most people. Right now it
does mostly everything I need, so I'm curious what would be necessary
to make it a viable tool for others to use.



More information about the rspec-users mailing list