Cucumber feature for managing contact requests
This commit is contained in:
parent
45e47513c2
commit
23c1ac4936
4 changed files with 289 additions and 271 deletions
|
|
@ -5,15 +5,18 @@ Feature: managing contact requests
|
||||||
And I have one contact request
|
And I have one contact request
|
||||||
|
|
||||||
Scenario: seeing contact requests
|
Scenario: seeing contact requests
|
||||||
When I am on the home page
|
When I am on the home page
|
||||||
Then I should see "Manage (1)" in the header
|
Then I should see "Manage (1)" in the header
|
||||||
|
|
||||||
@javascript @wip
|
@javascript @wip
|
||||||
Scenario: accepting a contact request
|
Scenario: accepting a contact request
|
||||||
|
Given I have an aspect called "Family"
|
||||||
|
|
||||||
When I am on the home page
|
When I am on the home page
|
||||||
And I follow "Manage (1)"
|
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"
|
And I should see 0 contacts in "Family"
|
||||||
|
|
||||||
When I drag the contact request to the "Family" aspect
|
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"
|
Then I should see 1 contact in "Family"
|
||||||
|
|
|
||||||
|
|
@ -25,3 +25,8 @@ end
|
||||||
When /^I wait for the home page to load$/ do
|
When /^I wait for the home page to load$/ do
|
||||||
wait_until { current_path == root_path }
|
wait_until { current_path == root_path }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
When /^I wait for the ajax to finish$/ do
|
||||||
|
pending
|
||||||
|
# wait_until { ??? }
|
||||||
|
end
|
||||||
|
|
@ -7,6 +7,11 @@ When /^I click on my name$/ do
|
||||||
click_link("#{@me.first_name} #{@me.last_name}")
|
click_link("#{@me.first_name} #{@me.last_name}")
|
||||||
end
|
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
|
Given /^I have one contact request$/ do
|
||||||
other_user = make_user
|
other_user = make_user
|
||||||
other_user.aspects.create!(:name => "meh")
|
other_user.aspects.create!(:name => "meh")
|
||||||
|
|
@ -17,14 +22,19 @@ Given /^I have one contact request$/ do
|
||||||
end
|
end
|
||||||
|
|
||||||
Then /^I should see (\d+) contact request(?:s)?$/ do |request_count|
|
Then /^I should see (\d+) contact request(?:s)?$/ do |request_count|
|
||||||
pending
|
number_of_requests = evaluate_script("$('.person.request.ui-draggable').length")
|
||||||
# person.request.ui-draggable.count.should == request_count - but how do I count things in CSS?
|
number_of_requests.should == request_count.to_i
|
||||||
end
|
end
|
||||||
|
|
||||||
Then /^I should see (\d+) contact(?:s)? in "([^"]*)"$/ do |request_count, aspect_name|
|
Then /^I should see (\d+) contact(?:s)? in "([^"]*)"$/ do |contact_count, aspect_name|
|
||||||
pending # express the regexp above with the code you wish you had
|
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
|
end
|
||||||
|
|
||||||
When /^I drag the contact request to the "([^"]*)" aspect$/ do |aspect_name|
|
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
|
end
|
||||||
|
|
|
||||||
526
spec/fixtures/users.yaml
vendored
526
spec/fixtures/users.yaml
vendored
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue