Add full request cycle cucumber feature
This commit is contained in:
parent
c38fbd27e4
commit
251cdec2ec
4 changed files with 34 additions and 5 deletions
26
features/connects_users.feature
Normal file
26
features/connects_users.feature
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
Feature: sending and receiving requests
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given a user with email "bob@bob.bob"
|
||||||
|
And a user with email "alice@alice.alice"
|
||||||
|
|
||||||
|
@javascript
|
||||||
|
Scenario: initiating and accepting a contact request
|
||||||
|
When I sign in as "bob@bob.bob"
|
||||||
|
And I am on "alice@alice.alice"'s page
|
||||||
|
And I press "add contact"
|
||||||
|
And I wait for the ajax to finish
|
||||||
|
Then I should see "sent!"
|
||||||
|
Then I go to the destroy user session page
|
||||||
|
|
||||||
|
When I sign in as "alice@alice.alice"
|
||||||
|
And I am on the aspects manage page
|
||||||
|
Then I should see 1 contact request
|
||||||
|
When I drag the contact request to the "Besties" aspect
|
||||||
|
And I wait for the ajax to finish
|
||||||
|
Then I should see 1 contact in "Besties"
|
||||||
|
|
||||||
|
When I go to the home page
|
||||||
|
Then I go to the aspects manage page
|
||||||
|
Then I should see 1 contact in "Besties"
|
||||||
|
|
||||||
|
|
@ -3,6 +3,12 @@ Given /^a user with username "([^\"]*)" and password "([^\"]*)"$/ do |username,
|
||||||
:password_confirmation => password, :getting_started => false)
|
:password_confirmation => password, :getting_started => false)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Given /^a user with email "([^\"]*)"$/ do |email|
|
||||||
|
user = Factory(:user, :email => email, :password => 'password',
|
||||||
|
:password_confirmation => 'password', :getting_started => false)
|
||||||
|
user.aspects.create(:name => "Besties")
|
||||||
|
end
|
||||||
|
|
||||||
Given /^I have been invited by an admin$/ do
|
Given /^I have been invited by an admin$/ do
|
||||||
@me = Invitation.create_invitee(:email => "new_invitee@example.com")
|
@me = Invitation.create_invitee(:email => "new_invitee@example.com")
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@ module NavigationHelpers
|
||||||
accept_user_invitation_path(:invitation_token => @me.invitation_token)
|
accept_user_invitation_path(:invitation_token => @me.invitation_token)
|
||||||
when /^the requestor's profile page$/
|
when /^the requestor's profile page$/
|
||||||
person_path(@me.reload.pending_requests.first.from)
|
person_path(@me.reload.pending_requests.first.from)
|
||||||
|
when /^"([^\"]*)"'s page$/
|
||||||
|
person_path(User.find_by_email($1).person)
|
||||||
when /^"(\/.*)"/
|
when /^"(\/.*)"/
|
||||||
$1
|
$1
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -25,11 +25,6 @@ Factory.define :person do |p|
|
||||||
p.serialized_public_key OpenSSL::PKey::RSA.generate(1024).public_key.export
|
p.serialized_public_key OpenSSL::PKey::RSA.generate(1024).public_key.export
|
||||||
end
|
end
|
||||||
|
|
||||||
Factory.define :album do |p|
|
|
||||||
p.name "my first album"
|
|
||||||
p.person { |a| Factory.create(:person) }
|
|
||||||
end
|
|
||||||
|
|
||||||
Factory.define :user do |u|
|
Factory.define :user do |u|
|
||||||
u.sequence(:username) {|n| "bob#{n}#{r_str}"}
|
u.sequence(:username) {|n| "bob#{n}#{r_str}"}
|
||||||
u.sequence(:email) {|n| "bob#{n}#{r_str}@pivotallabs.com"}
|
u.sequence(:email) {|n| "bob#{n}#{r_str}@pivotallabs.com"}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue