I am working on a rails application to train BDD on my own and test in general. Using cucumber + webrat + rspec, after relaying the video is turned off. In this application, the quiz has several questions. The view I'm testing should pose the question twice and not contiguously. (not adjoining here) I have a cucumber script aimed at checking this
Given quiz titled "Pearl Jam" has questions named "Corduroy, Dissident"
When I go to the experiment page for quiz titled "Pearl Jam"
Then I should see "Corduroy" twice
And I should see "Dissident" twice
My step is defined as follows:
Then /^I should see "([^\"]*)" twice$/ do |text|
regexp = Regexp.new(text + "(.+)" + text)
response.should contain(regexp)
end
I tested the regex with a tool, and it seems to work, but the test does not work on the cucumber.
I searched Google for documentation, but webrat documentation is an API docs; I could not get the answer displayed as text. Any suggestion?