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
|
||||
Feature: Invitations
|
||||
Background:
|
||||
Given following users exist:
|
||||
| username | email |
|
||||
| Alice Smith | alice@alice.alice |
|
||||
|
||||
Scenario: Accepting an invitation
|
||||
When I visit alice's invitation code url
|
||||
When I fill in the new user form
|
||||
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 see the "welcome to diaspora" message
|
||||
And I should be able to friend Alice
|
||||
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 "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
|
||||
Feature: Invitations
|
||||
Background:
|
||||
Given following users exist:
|
||||
| username | email |
|
||||
| Alice Smith | alice@alice.alice |
|
||||
|
||||
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
|
||||
And I press "Create my account!"
|
||||
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!
|
||||
end
|
||||
|
||||
Given /^I have been invited by bob$/ do
|
||||
@inviter = FactoryGirl.create(:user, :email => 'bob@bob.bob')
|
||||
Given /^I have been invited by "([^\"]+)"$/ do |email|
|
||||
@inviter = User.find_by_email(email)
|
||||
@inviter_invite_count = @inviter.invitation_code.count
|
||||
i = EmailInviter.new("new_invitee@example.com", @inviter)
|
||||
i.send!
|
||||
|
|
@ -200,20 +200,14 @@ When /^I view "([^\"]*)"'s first post$/ do |email|
|
|||
visit post_path(post)
|
||||
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
|
||||
fill_in_new_user_form
|
||||
end
|
||||
|
||||
And /^I should be able to friend Alice$/ do
|
||||
alice = User.find_by_username 'alice'
|
||||
And /^I should be able to friend "([^\"]*)"$/ do |email|
|
||||
user = User.find_by_email(email)
|
||||
step 'I should see "Add contact"'
|
||||
step "I should see \"#{alice.name}\""
|
||||
step "I should see \"#{user.name}\""
|
||||
end
|
||||
|
||||
When /^I click the sign in button$/ do
|
||||
|
|
|
|||
Loading…
Reference in a new issue