Skip to content

Instantly share code, notes, and snippets.

@plagelao
Created February 16, 2011 22:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plagelao/830456 to your computer and use it in GitHub Desktop.
Save plagelao/830456 to your computer and use it in GitHub Desktop.
Given a "XBox" with a price of "250€"
When I ask for the catalogue
Then I can see in the catalogue a "XBox" with a price of "250€"
Given /^a "([^"]*)" with a price of "([^"]*)"$/ do |product, price|
Product.create(:name => product, :price => price)
end
When /^I ask for the catalogue$/ do
visit products_path
click_link "Catalogue"
end
Then /^I can see in the catalogue a "([^"]*)" with a price of "([^"]*)"$/ do |product, price|
first_row(page.body).should =~ Regexp.new("#{product} - #{price}")
end
def first_row(stream)
#Stuff to read an excel file
#Stuff to get the first line of the excel spreadsheet
end
Then /^I can see in the catalogue a "([^"]*)" with a price of "([^"]*)"$/ do |product, price|
page.body.should =~ Regexp.new("#{product} - #{price}")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment