[rspec-users] How to write a step for a feature with a select control
lists at ruby-forum.com
Tue Sep 16 15:00:42 EDT 2008
I managed to get it to work using David's option 1.
> 1. add the data in a previous step
> Given /an? (.*) named "(.*)"$/ do |class_name, object_name|
My Scenario now goes:
Given an Article Category named "My Article Category"
And I am on the new article page
When I fill in "Title" with "My article title"
And I fill in "Summary" with "My article summary"
And I fill in "Body" with "My article body"
And I check "Is Live"
And I pick "My Article Category" from Article Category
And I press "Create"
Then I should see "My article title"
And I should see "My article summary"
And I should see "My article body"
And I should see "Article is live"
And I should see "My Article Category"
And that works. I could not get it to work using David's option 2
> 2. add the data in the current step
> When(/^I pick "(.*)" from (.*)$/) do |option_value, field_name|
> selects option_value, :from => field_name
Have I broken any rules, or is that OK?
Posted via http://www.ruby-forum.com/.
More information about the rspec-users