On Tue, Sep 16, 2008 at 6:43 AM, Joseph W. [email protected]
Damian J. wrote:
I was wondering what the correct procedure would be for spec’ing the
following story line
First, a bit of remedial terminology
For better or worse, we generally use “spec’ing” to describe driving
out application code with code examples.
What you’re calling a “story line” is simply a “step.”
The thing you’re looking for (the correct procedure) is a “step
better way of doing this?
Sounds right. You could use either a string in your when step.
… step definition …
When(“I pick ‘$option’ from my ‘$field’”) do |option, field|
OR you could use a regular expression
When(/^I pick ‘(.?)’ from my '(.?)’$/) do |option, field|
I think Damian is looking for what to do in the step definition, not
necessarily the expression to match it.
Damian - I take it that Article Categories are themselves data driven,
yes? If so, I’d do one of two things:
- add the data in a previous step
Given /an? (.) named "(.)"$/ do |class_name, object_name|
- add the data in the current step
When(/^I pick "(.)" from (.)$/) do |option_value, field_name|
selects option_value, :from => field_name
The “selects option_value …” statement is using Webrat, in case
you’re not familiar.