[rspec-users] How to write a step for a feature with a select control
lists at ruby-forum.com
Tue Sep 16 07:43:51 EDT 2008
Damian Jones wrote:
> I was wondering what the correct procedure would be for spec'ing the
> following story line
> When I pick "My Option" from "My Field"
> "My Field" would be an Article Category select control, when running my
> feature the control does not have any data bound to it.
> I am guessing I would somehow bind the control to some data in the
> corresponding Step
> Am I going along the right lines, or can someone enlighten me with a
> better way of doing this?
Sounds right. You could use either a string in your when step.
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|
Posted via http://www.ruby-forum.com/.
More information about the rspec-users