Cucumber feature for managing contact requests

This commit is contained in:
Sarah Mei 2010-11-14 21:49:56 -08:00
parent 45e47513c2
commit 23c1ac4936
4 changed files with 289 additions and 271 deletions

View file

@ -5,15 +5,18 @@ Feature: managing contact requests
And I have one contact request
Scenario: seeing contact requests
When I am on the home page
Then I should see "Manage (1)" in the header
When I am on the home page
Then I should see "Manage (1)" in the header
@javascript @wip
Scenario: accepting a contact request
Given I have an aspect called "Family"
When I am on the home page
And I follow "Manage (1)"
Then I should see 1 contact request
Then I should see 1 contact request
And I should see 0 contacts in "Family"
When I drag the contact request to the "Family" aspect
And I wait for the ajax to finish
Then I should see 1 contact in "Family"

View file

@ -24,4 +24,9 @@ end
When /^I wait for the home page to load$/ do
wait_until { current_path == root_path }
end
When /^I wait for the ajax to finish$/ do
pending
# wait_until { ??? }
end

View file

@ -7,6 +7,11 @@ When /^I click on my name$/ do
click_link("#{@me.first_name} #{@me.last_name}")
end
Given /^I have an aspect called "([^"]*)"$/ do |aspect_name|
@me.aspects.create!(:name => aspect_name)
@me.reload
end
Given /^I have one contact request$/ do
other_user = make_user
other_user.aspects.create!(:name => "meh")
@ -17,14 +22,19 @@ Given /^I have one contact request$/ do
end
Then /^I should see (\d+) contact request(?:s)?$/ do |request_count|
pending
# person.request.ui-draggable.count.should == request_count - but how do I count things in CSS?
number_of_requests = evaluate_script("$('.person.request.ui-draggable').length")
number_of_requests.should == request_count.to_i
end
Then /^I should see (\d+) contact(?:s)? in "([^"]*)"$/ do |request_count, aspect_name|
pending # express the regexp above with the code you wish you had
Then /^I should see (\d+) contact(?:s)? in "([^"]*)"$/ do |contact_count, aspect_name|
aspect = @me.reload.aspects.find_by_name(aspect_name)
number_of_contacts = evaluate_script("$('li.person.ui-draggable[data-aspect_id=\"#{aspect.id}\"]').length")
number_of_contacts.should == contact_count.to_i
end
When /^I drag the contact request to the "([^"]*)" aspect$/ do |aspect_name|
pending # express the regexp above with the code you wish you had
aspect = @me.reload.aspects.find_by_name(aspect_name)
aspect_div = find("ul.dropzone[data-aspect_id='#{aspect.id}']")
request_li = find(".person.request.ui-draggable")
request_li.drag_to(aspect_div)
end

File diff suppressed because it is too large Load diff