Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJX Terry <jxterry@protonmail.com>2018-07-24 15:46:19 +0300
committerDouwe Maan <douwe@gitlab.com>2018-07-24 15:46:19 +0300
commit99011a61cf4136c806e7de43fcd55475d2407fa1 (patch)
tree99486b31dc0df1b86db0bb11ec32b05c9bc1fb2d /spec/finders
parentadc327d3fa72b9f5b9c42c629c99f0a89ca15192 (diff)
Add an option to have a private profile on GitLab
Diffstat (limited to 'spec/finders')
-rw-r--r--spec/finders/user_recent_events_finder_spec.rb15
1 files changed, 13 insertions, 2 deletions
diff --git a/spec/finders/user_recent_events_finder_spec.rb b/spec/finders/user_recent_events_finder_spec.rb
index da043f94021..58470f4c84d 100644
--- a/spec/finders/user_recent_events_finder_spec.rb
+++ b/spec/finders/user_recent_events_finder_spec.rb
@@ -29,11 +29,22 @@ describe UserRecentEventsFinder do
public_project.add_developer(current_user)
end
- it 'returns all the events' do
- expect(finder.execute).to include(private_event, internal_event, public_event)
+ context 'when profile is public' do
+ it 'returns all the events' do
+ expect(finder.execute).to include(private_event, internal_event, public_event)
+ end
+ end
+
+ context 'when profile is private' do
+ it 'returns no event' do
+ allow(Ability).to receive(:allowed?).and_call_original
+ allow(Ability).to receive(:allowed?).with(current_user, :read_user_profile, project_owner).and_return(false)
+ expect(finder.execute).to be_empty
+ end
end
it 'does not include the events if the user cannot read cross project' do
+ expect(Ability).to receive(:allowed?).and_call_original
expect(Ability).to receive(:allowed?).with(current_user, :read_cross_project) { false }
expect(finder.execute).to be_empty
end