From the easy when you finally know what you are doing, column....
How the hell do you setup a select menu in a feature?
Well, it turns out it's easy. Not obvious to me, as nothing is in this testing BDD world, however. Basically For every select menu you want to use in a feature, you must create a Background scenario to populate that select menu before every feature is ran
Here's the code
Feature: Manage Driver lineup as an admin
In order to manage all drivers
As an admin
I want to be able to create and edit a list of drivers.
Background:
Given I create a series "Nascar"
Scenario: Login as admin
Given I am logged in as an admin
When I go to the admin homepage
And I follow "New Driver"
When I fill in "Name" with "Darryl Waltrip"
And I select "Nascar" from "Series"
And I press "Create"
Then I should see "New Driver saved succesfully"
Nascar and all other known shit in the code above is copyright of their respective entities. I am just using it as an example, so chilax
Now in the background step you can just create the list of series(as i have it) using factories as so...
Given /^I create a series "([^\"]*)"$/ do |arg1|
Factory(:league, :name => arg1)
end
Enjoy. yes it was easy, just no one told me how to do it, so i thought i'd see if i could help another soul out.
thanks dude
ReplyDeletenp dude. although i prefer straight up test::unit now. also, check out my blog http://www.ingraminternet.com boom!
ReplyDeleteI have a scenario that I need to do it as you say, but in another feature it's work with the Given in the scenario.
ReplyDeleteI really don't know what the difference is....