I'm doing what it says in the subject line, and I thought I'd post
notes and links. For those who don't know, Cucumber (http://cukes.info/
a BDD tool, successor to RSpec's story runner, that lets you
desired behavior ("features") in something that looks like human
and then write the code that defines the behavior ("steps") in
(http://github.com/brynary/webrat/tree/master) is an acceptance
that lets you write steps that emulate browser interaction -
filling in forms - without the overhead of actually firing up a
You all know what Radiant is.
(I'm working with Radiant 0.6.9, unfortunately, because I want my
to support an existing site. But I suspect the basic steps will
The basic setup went pretty quickly. The instructions for using
with Rails (http://wiki.github.com/aslakhellesoy/cucumber/ruby-on-rails
- install a bunch of gems
- create a Rails project (I already had a Radiant project)
- run the cucumber generator
In my case, script/generate didn't know about Cucumber, I guess
Radiant looks for generators in other places. So I created a new
project, ran the generator there, and copied the files that looked
into my Radiant extension. I'm reconstructing this from the git
commit - it
looks like the files were:
I modified env.rb in two ways:
- The path to config/environment is three steps higher
- Load fixtures from spec/ (see
That was pretty much it - I'm now able to start writing features
There was one major hitch. I wrote a step definition that goes
When /^I visit the "(.+)" admin page$/ do |page|
... and a feature that goes like this, in part:
When I visit the "Anno Domini" admin page
And I fill in "Address" with "366 So. First Street, San Jose, CA
And I press "Save and Continue Editing"
You can guess what that does. On the last step, when the form was
submitted, I got the error "Couldn't find Page without an ID".
form, in the test environment only, was being created with
action="/admin/page/edit" (note the missing page ID) instead of
Turns out that in the test environment, Radiant adds its own test
to the extension paths. If you're configured to load all
will include BasicExtension, which sets up a default route that
gets in the
way of page_edit_path, and probably a lot of other paths.
For anyone else traveling this path, the way I got around this was
my extension was the only one loaded, by putting this line in
config/environment.rb in my project:
config.extensions = [ :locations ] if config.environment == 'test'
There may be a better way, but this is probably good enough.
forward, I see that in 0.7, the route that caused the trouble is
Hope this is useful. When the extension is a little more
functional, I plan
to put it up on Github, so there'll be some sample code.
Hellesoy's Ba extension (http://github.com/aslakhellesoy/ba/tree/master
I think a little behind current practices, but it's where I got
most of my
Radiant mailing list