Merge pull request #6740 from svbergerem/refactor-cukes
Refactor invitations and public stream cukes
This commit is contained in:
commit
d5560430ce
7 changed files with 89 additions and 82 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
|
||||
|
|
|
|||
|
|
@ -5,26 +5,10 @@ Feature: The public stream
|
|||
| username | email |
|
||||
| Alice Smith | alice@alice.alice |
|
||||
| Bob Jones | bob@bob.bob |
|
||||
| Eve Doe | eve@eve.eve |
|
||||
And a user with email "alice@alice.alice" is connected with "bob@bob.bob"
|
||||
|
||||
And "bob@bob.bob" has a public post with text "Bob’s public post"
|
||||
And "bob@bob.bob" has a non public post with text "Bob’s private post"
|
||||
And "eve@eve.eve" has a public post with text "Eve’s public post"
|
||||
|
||||
Scenario: seeing public posts of someone you don't follow
|
||||
When I sign in as "alice@alice.alice"
|
||||
Then I should not see "Eve’s public post"
|
||||
When I am on the public stream page
|
||||
Then I should see "Eve’s public post"
|
||||
|
||||
Scenario: seeing public posts of someone you follow
|
||||
Scenario: seeing public posts
|
||||
When I sign in as "alice@alice.alice"
|
||||
And I am on the public stream page
|
||||
Then I should see "Bob’s public post"
|
||||
When I am on the public stream page
|
||||
Then I should see "Bob’s public post"
|
||||
|
||||
Scenario: not seeing private posts of someone you follow
|
||||
When I sign in as "alice@alice.alice"
|
||||
Then I should see "Bob’s private post"
|
||||
When I am on the public stream page
|
||||
Then I should not see "Bob’s private post"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
21
spec/lib/diaspora/shareable_spec.rb
Normal file
21
spec/lib/diaspora/shareable_spec.rb
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
require "spec_helper"
|
||||
|
||||
describe Diaspora::Shareable do
|
||||
describe "scopes" do
|
||||
describe ".all_public" do
|
||||
it "includes all public posts" do
|
||||
post1 = FactoryGirl.create(:status_message, author: alice.person, public: true)
|
||||
post2 = FactoryGirl.create(:status_message, author: bob.person, public: true)
|
||||
post3 = FactoryGirl.create(:status_message, author: eve.person, public: true)
|
||||
expect(Post.all_public.map(&:id)).to eq([post1.id, post2.id, post3.id])
|
||||
end
|
||||
|
||||
it "doesn't include any private posts" do
|
||||
FactoryGirl.create(:status_message, author: alice.person, public: false)
|
||||
FactoryGirl.create(:status_message, author: bob.person, public: false)
|
||||
FactoryGirl.create(:status_message, author: eve.person, public: false)
|
||||
expect(Post.all_public.map(&:id)).to eq([])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -9,4 +9,11 @@ describe Stream::Public do
|
|||
describe 'shared behaviors' do
|
||||
it_should_behave_like 'it is a stream'
|
||||
end
|
||||
|
||||
describe "#posts" do
|
||||
it "calls Post#all_public" do
|
||||
expect(Post).to receive(:all_public)
|
||||
@stream.posts
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue