Merge pull request #3488 from devendram/cukes-refactoring

Adding step definitions to facilitate merging of multiple consecutive "I...
This commit is contained in:
Maxwell Salzberg 2012-08-14 11:09:43 -07:00
commit c3efa1df97
2 changed files with 17 additions and 15 deletions

View file

@ -8,9 +8,7 @@ Feature: new user registration
And I fill in "user_password" with "secret"
And I press "Continue"
Then I should be on the getting started page
And I should see "Well, hello there!"
And I should see "Who are you?"
And I should see "What are you into?"
And I should see "Well, hello there!" and "Who are you?" and "What are you into?"
Scenario: new user goes through the setup wizard
When I fill in the following:

View file

@ -105,12 +105,14 @@ Then /^(?:|I )should see JSON:$/ do |expected_json|
expected.should == actual
end
Then /^(?:|I )should see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector|
with_scope(selector) do
if page.respond_to? :should
page.should have_content(text)
else
assert page.has_content?(text)
Then /^(?:|I )should see (\".+?\"[\s]*)(?:[\s]+within[\s]* "([^"]*)")?$/ do |vars,selector|
vars.scan(/"([^"]+?)"/).flatten.each do |text|
with_scope(selector) do
if page.respond_to? :should
page.should have_content(text)
else
assert page.has_content?(text)
end
end
end
end
@ -126,12 +128,14 @@ Then /^(?:|I )should see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, select
end
end
Then /^(?:|I )should not see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector|
with_scope(selector) do
if page.respond_to? :should
page.should have_no_content(text)
else
assert page.has_no_content?(text)
Then /^(?:|I )should not see (\".+?\"[\s]*)(?:[\s]+within[\s]* "([^"]*)")?$/ do |vars,selector|
vars.scan(/"([^"]+?)"/).flatten.each do |text|
with_scope(selector) do
if page.respond_to? :should
page.should have_no_content(text)
else
assert page.has_no_content?(text)
end
end
end
end