diff --git a/features/connects_users.feature b/features/connects_users.feature new file mode 100644 index 000000000..122834502 --- /dev/null +++ b/features/connects_users.feature @@ -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" + diff --git a/features/step_definitions/user_steps.rb b/features/step_definitions/user_steps.rb index 4ff3a9511..4f052f998 100644 --- a/features/step_definitions/user_steps.rb +++ b/features/step_definitions/user_steps.rb @@ -3,6 +3,12 @@ Given /^a user with username "([^\"]*)" and password "([^\"]*)"$/ do |username, :password_confirmation => password, :getting_started => false) 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 @me = Invitation.create_invitee(:email => "new_invitee@example.com") end diff --git a/features/support/paths.rb b/features/support/paths.rb index 3e985bc3e..e5dfce099 100644 --- a/features/support/paths.rb +++ b/features/support/paths.rb @@ -13,6 +13,8 @@ module NavigationHelpers accept_user_invitation_path(:invitation_token => @me.invitation_token) when /^the requestor's profile page$/ person_path(@me.reload.pending_requests.first.from) + when /^"([^\"]*)"'s page$/ + person_path(User.find_by_email($1).person) when /^"(\/.*)"/ $1 else diff --git a/spec/factories.rb b/spec/factories.rb index ef90d99a4..58933eade 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -25,11 +25,6 @@ Factory.define :person do |p| p.serialized_public_key OpenSSL::PKey::RSA.generate(1024).public_key.export end -Factory.define :album do |p| - p.name "my first album" - p.person { |a| Factory.create(:person) } -end - Factory.define :user do |u| u.sequence(:username) {|n| "bob#{n}#{r_str}"} u.sequence(:email) {|n| "bob#{n}#{r_str}@pivotallabs.com"}