Move some multi stream and person stream cukes to rspec
This commit is contained in:
parent
6e6a5c1e29
commit
9d591c6433
3 changed files with 37 additions and 40 deletions
|
|
@ -12,25 +12,6 @@ Feature: following and being followed
|
|||
And I add the person to my "Besties" aspect
|
||||
And I sign out
|
||||
|
||||
Scenario: seeing a follower's posts on their profile page, but not in your stream
|
||||
Given "bob@bob.bob" has a non public post with text "I am following you"
|
||||
When I sign in as "alice@alice.alice"
|
||||
And I am on "bob@bob.bob"'s page
|
||||
Then I should see "I am following you"
|
||||
|
||||
When I go to the home page
|
||||
Then I should not see "I am following you"
|
||||
|
||||
Scenario: seeing public posts of someone you follow
|
||||
Given "alice@alice.alice" has a public post with text "I am ALICE"
|
||||
|
||||
When I sign in as "bob@bob.bob"
|
||||
And I am on "alice@alice.alice"'s page
|
||||
Then I should see "I am ALICE"
|
||||
|
||||
When I go to the home page
|
||||
Then I should see "I am ALICE"
|
||||
|
||||
Scenario: I follow a malicious user
|
||||
When I sign in as "bob@bob.bob"
|
||||
And I go to the edit profile page
|
||||
|
|
@ -44,21 +25,6 @@ Feature: following and being followed
|
|||
And I add the person to my "Besties" aspect
|
||||
Then I should see a flash message containing "You have started sharing with <script>alert(0)//!"
|
||||
|
||||
Scenario: seeing non-public posts of someone you follow who also follows you
|
||||
When I sign in as "alice@alice.alice"
|
||||
And I am on "bob@bob.bob"'s page
|
||||
And I add the person to my "Besties" aspect
|
||||
And I add the person to my "Unicorns" aspect
|
||||
And I go to the home page
|
||||
Then I should have 1 contact in "Unicorns"
|
||||
And I should have 1 contact in "Besties"
|
||||
|
||||
When I click the publisher and post "I am following you back"
|
||||
And I sign out
|
||||
And I sign in as "bob@bob.bob"
|
||||
Then I should have 1 contacts in "Besties"
|
||||
And I should see "I am following you back"
|
||||
|
||||
Scenario: adding someone who follows you while creating a new aspect
|
||||
When I sign in as "alice@alice.alice"
|
||||
And I am on "bob@bob.bob"'s page
|
||||
|
|
|
|||
|
|
@ -1,12 +1,36 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe EvilQuery::MultiStream do
|
||||
let(:evil_query) { EvilQuery::MultiStream.new(alice, 'created_at', Time.now-1.week, true) }
|
||||
let(:evil_query) { EvilQuery::MultiStream.new(alice, "created_at", Time.zone.now, true) }
|
||||
|
||||
describe 'community_spotlight_posts!' do
|
||||
it 'does not raise an error' do
|
||||
expect { evil_query.community_spotlight_posts! }.to_not raise_error
|
||||
end
|
||||
end
|
||||
|
||||
describe "make_relation!" do
|
||||
it "includes public posts of someone you follow" do
|
||||
alice.share_with(eve.person, alice.aspects.first)
|
||||
public_post = eve.post(:status_message, text: "public post", to: "all", public: true)
|
||||
expect(evil_query.make_relation!.map(&:id)).to include(public_post.id)
|
||||
end
|
||||
|
||||
it "includes private posts of contacts with a mutual relationship" do
|
||||
alice.share_with(eve.person, alice.aspects.first)
|
||||
eve.share_with(alice.person, eve.aspects.first)
|
||||
private_post = eve.post(:status_message, text: "private post", to: eve.aspects.first.id, public: false)
|
||||
expect(evil_query.make_relation!.map(&:id)).to include(private_post.id)
|
||||
end
|
||||
|
||||
it "doesn't include posts of followers that you don't follow back" do
|
||||
eve.share_with(alice.person, eve.aspects.first)
|
||||
public_post = eve.post(:status_message, text: "public post", to: "all", public: true)
|
||||
private_post = eve.post(:status_message, text: "private post", to: eve.aspects.first.id, public: false)
|
||||
expect(evil_query.make_relation!.map(&:id)).not_to include(public_post.id)
|
||||
expect(evil_query.make_relation!.map(&:id)).not_to include(private_post.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe EvilQuery::Participation do
|
||||
|
|
|
|||
|
|
@ -2,12 +2,20 @@ require 'spec_helper'
|
|||
require Rails.root.join('spec', 'shared_behaviors', 'stream')
|
||||
|
||||
describe Stream::Person do
|
||||
describe "shared behaviors" do
|
||||
before do
|
||||
@stream = Stream::Person.new(alice, bob.person, :max_time => Time.now, :order => 'updated_at')
|
||||
@stream = Stream::Person.new(alice, bob.person, max_time: Time.zone.now, order: "updated_at")
|
||||
end
|
||||
|
||||
describe 'shared behaviors' do
|
||||
it_should_behave_like 'it is a stream'
|
||||
it_should_behave_like "it is a stream"
|
||||
end
|
||||
|
||||
describe "#posts" do
|
||||
it "calls user#posts_from if the user is present" do
|
||||
stream = Stream::Person.new(alice, bob.person, max_time: Time.zone.now, order: "updated_at")
|
||||
expect(alice).to receive(:posts_from).with(bob.person)
|
||||
stream.posts
|
||||
end
|
||||
end
|
||||
|
||||
it "returns the most recent posts" do
|
||||
|
|
@ -29,5 +37,4 @@ describe Stream::Person do
|
|||
|
||||
expect(fetched_posts).to eq(posts)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue