[rspec-users] How to write a step for a feature with a select control

Damian Jones lists at ruby-forum.com
Tue Sep 16 11:39:36 EDT 2008

Sorry David,
 I don't really  understand.

> When(/^I pick "(.*)" from (.*)$/) do |option_value, field_name|
>   field_name.gsub(' ','').constantize.find_or_create_by_name(option_value)
>   selects option_value, :from => field_name
> end

>> field_name.gsub(' ','').constantize.find_or_create_by_name(option_value)
-- This line creates a new ArticleCategory, but where does that 
ArticleCategory go, or how is it used?

>> selects option_value, :from => field_name
-- Then this tries to select that ArticleCategory from the select 

Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list