Clean up web steps that are too complicated to follow

This commit is contained in:
Sarah Mei 2011-09-05 15:17:37 -07:00
parent 22b65bd3c1
commit d646428a5e
2 changed files with 3 additions and 5 deletions

View file

@ -93,7 +93,7 @@ When /^I press the first "([^"]*)"(?: within "([^"]*)")?$/ do |link_selector, wi
end
end
When /^I press the ([\d])(nd|rd|st|th) "([^\"]*)"(?: within "([^\"]*)")?$/ do |number, rd, link_selector, within_selector|
When /^I press the ([\d])(?:nd|rd|st|th) "([^\"]*)"(?: within "([^\"]*)")?$/ do |number, link_selector, within_selector|
with_scope(within_selector) do
find(:css, link_selector+":nth-child(#{number})").click
end

View file

@ -94,15 +94,14 @@ Given /^many posts from alice for bob$/ do
end
end
Then /^I should have (\d) contacts? in "([^"]*)"$/ do |n_contacts, aspect_name|
@me.aspects.where(:name => aspect_name).first.contacts.count.should == n_contacts.to_i
end
When /^I (add|remove|toggle) the person (to|from) my ([\d])(nd|rd|st|th) aspect$/ do |word1, word2, aspect_number, nd|
When /^I (?:add|remove) the person (?:to|from) my (1st|2nd) aspect$/ do |aspect_ordinal|
steps %Q{
And I press the first ".toggle.button"
And I press the #{aspect_number}#{nd} "li" within ".dropdown.active .dropdown_list"
And I press the #{aspect_ordinal} "li" within ".dropdown.active .dropdown_list"
And I press the first ".toggle.button"
}
end
@ -111,7 +110,6 @@ When /^I post a status with the text "([^\"]*)"$/ do |text|
@me.post(:status_message, :text => text, :public => true, :to => 'all')
end
And /^I follow the "([^\"]*)" link from the last sent email$/ do |link_text|
email_text = Devise.mailer.deliveries.first.body.to_s
email_text = Devise.mailer.deliveries.first.html_part.body.raw_source if email_text.blank?