Refactor invitation cukes
This commit is contained in:
parent
e90f72ff37
commit
79d53f2f59
4 changed files with 58 additions and 63 deletions
|
|
@ -1,45 +0,0 @@
|
||||||
@javascript
|
|
||||||
Feature: invitation acceptance
|
|
||||||
Scenario: accept invitation from admin
|
|
||||||
Given I have been invited by an admin
|
|
||||||
And I am on my acceptance form page
|
|
||||||
And I fill in the new user form
|
|
||||||
And I press "Sign up"
|
|
||||||
Then I should be on the getting started page
|
|
||||||
And I should see "Well, hello there!"
|
|
||||||
And I fill in the following:
|
|
||||||
| profile_first_name | O |
|
|
||||||
|
|
||||||
And I follow "awesome_button"
|
|
||||||
And I confirm the alert
|
|
||||||
Then I should be on the stream page
|
|
||||||
And I close the publisher
|
|
||||||
|
|
||||||
Scenario: accept invitation from user
|
|
||||||
Given I have been invited by bob
|
|
||||||
And I am on my acceptance form page
|
|
||||||
And I fill in the new user form
|
|
||||||
And I press "Sign up"
|
|
||||||
Then I should be on the getting started page
|
|
||||||
And I should see "Well, hello there!"
|
|
||||||
And I fill in the following:
|
|
||||||
| profile_first_name | O |
|
|
||||||
|
|
||||||
And I follow "awesome_button"
|
|
||||||
And I confirm the alert
|
|
||||||
Then I should be on the stream page
|
|
||||||
And I close the publisher
|
|
||||||
And I log out
|
|
||||||
And I sign in as "bob@bob.bob"
|
|
||||||
And I click on selector "#invitations-button"
|
|
||||||
Then I should see one less invite
|
|
||||||
|
|
||||||
Scenario: sends an invitation
|
|
||||||
Given a user with email "bob@bob.bob"
|
|
||||||
When I sign in as "bob@bob.bob"
|
|
||||||
And I click on selector "#invitations-button"
|
|
||||||
And I fill in the following:
|
|
||||||
| email_inviter_emails | alex@example.com |
|
|
||||||
And I press "Send an invitation"
|
|
||||||
Then I should have 1 Devise email delivery
|
|
||||||
And I should not see "change your notification settings" in the last sent email
|
|
||||||
|
|
@ -1,9 +1,50 @@
|
||||||
@javascript
|
@javascript
|
||||||
Feature: Invitations
|
Feature: Invitations
|
||||||
|
Background:
|
||||||
|
Given following users exist:
|
||||||
|
| username | email |
|
||||||
|
| Alice Smith | alice@alice.alice |
|
||||||
|
|
||||||
Scenario: Accepting an invitation
|
Scenario: accept invitation from admin
|
||||||
When I visit alice's invitation code url
|
Given I have been invited by an admin
|
||||||
When I fill in the new user form
|
And I am on my acceptance form page
|
||||||
|
And I fill in the new user form
|
||||||
And I press "Sign up"
|
And I press "Sign up"
|
||||||
Then I should see the "welcome to diaspora" message
|
Then I should be on the getting started page
|
||||||
And I should be able to friend Alice
|
And I should see "Well, hello there!"
|
||||||
|
And I fill in the following:
|
||||||
|
| profile_first_name | O |
|
||||||
|
|
||||||
|
And I follow "awesome_button"
|
||||||
|
And I confirm the alert
|
||||||
|
Then I should be on the stream page
|
||||||
|
And I close the publisher
|
||||||
|
|
||||||
|
Scenario: accept invitation from user
|
||||||
|
Given I have been invited by "alice@alice.alice"
|
||||||
|
And I am on my acceptance form page
|
||||||
|
And I fill in the new user form
|
||||||
|
And I press "Sign up"
|
||||||
|
Then I should be on the getting started page
|
||||||
|
And I should see "Well, hello there!"
|
||||||
|
And I should be able to friend "alice@alice.alice"
|
||||||
|
And I fill in the following:
|
||||||
|
| profile_first_name | O |
|
||||||
|
|
||||||
|
And I follow "awesome_button"
|
||||||
|
And I confirm the alert
|
||||||
|
Then I should be on the stream page
|
||||||
|
And I close the publisher
|
||||||
|
And I log out
|
||||||
|
And I sign in as "alice@alice.alice"
|
||||||
|
And I click on selector "#invitations-button"
|
||||||
|
Then I should see one less invite
|
||||||
|
|
||||||
|
Scenario: sends an invitation
|
||||||
|
When I sign in as "alice@alice.alice"
|
||||||
|
And I click on selector "#invitations-button"
|
||||||
|
And I fill in the following:
|
||||||
|
| email_inviter_emails | alex@example.com |
|
||||||
|
And I press "Send an invitation"
|
||||||
|
Then I should have 1 Devise email delivery
|
||||||
|
And I should not see "change your notification settings" in the last sent email
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,14 @@
|
||||||
@javascript @mobile
|
@javascript @mobile
|
||||||
Feature: Invitations
|
Feature: Invitations
|
||||||
|
Background:
|
||||||
|
Given following users exist:
|
||||||
|
| username | email |
|
||||||
|
| Alice Smith | alice@alice.alice |
|
||||||
|
|
||||||
Scenario: Accepting an invitation
|
Scenario: Accepting an invitation
|
||||||
When I visit alice's invitation code url
|
Given I have been invited by "alice@alice.alice"
|
||||||
|
And I am on my acceptance form page
|
||||||
When I fill in the new user form
|
When I fill in the new user form
|
||||||
And I press "Create my account!"
|
And I press "Create my account!"
|
||||||
Then I should see the "welcome to diaspora" message
|
Then I should see the "welcome to diaspora" message
|
||||||
And I should be able to friend Alice
|
And I should be able to friend "alice@alice.alice"
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,8 @@ Given /^I have been invited by an admin$/ do
|
||||||
i.send!
|
i.send!
|
||||||
end
|
end
|
||||||
|
|
||||||
Given /^I have been invited by bob$/ do
|
Given /^I have been invited by "([^\"]+)"$/ do |email|
|
||||||
@inviter = FactoryGirl.create(:user, :email => 'bob@bob.bob')
|
@inviter = User.find_by_email(email)
|
||||||
@inviter_invite_count = @inviter.invitation_code.count
|
@inviter_invite_count = @inviter.invitation_code.count
|
||||||
i = EmailInviter.new("new_invitee@example.com", @inviter)
|
i = EmailInviter.new("new_invitee@example.com", @inviter)
|
||||||
i.send!
|
i.send!
|
||||||
|
|
@ -200,20 +200,14 @@ When /^I view "([^\"]*)"'s first post$/ do |email|
|
||||||
visit post_path(post)
|
visit post_path(post)
|
||||||
end
|
end
|
||||||
|
|
||||||
Given /^I visit alice's invitation code url$/ do
|
|
||||||
@alice ||= FactoryGirl.create(:user, :username => 'alice', :getting_started => false)
|
|
||||||
invite_code = InvitationCode.find_or_create_by(user_id: @alice.id)
|
|
||||||
visit invite_code_path(invite_code)
|
|
||||||
end
|
|
||||||
|
|
||||||
When /^I fill in the new user form/ do
|
When /^I fill in the new user form/ do
|
||||||
fill_in_new_user_form
|
fill_in_new_user_form
|
||||||
end
|
end
|
||||||
|
|
||||||
And /^I should be able to friend Alice$/ do
|
And /^I should be able to friend "([^\"]*)"$/ do |email|
|
||||||
alice = User.find_by_username 'alice'
|
user = User.find_by_email(email)
|
||||||
step 'I should see "Add contact"'
|
step 'I should see "Add contact"'
|
||||||
step "I should see \"#{alice.name}\""
|
step "I should see \"#{user.name}\""
|
||||||
end
|
end
|
||||||
|
|
||||||
When /^I click the sign in button$/ do
|
When /^I click the sign in button$/ do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue