summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2018-09-11 18:15:06 +0000
committerRobert Speicher <robert@gitlab.com>2018-09-11 18:15:06 +0000
commite91dc8f4badfdb4742d1662f34edd85f43fb317f (patch)
tree6ba93cc4eac82b03eab8a5e12909935b963de139 /spec
parentb65c39cabab82d5db5ebfcb54df64c50cd3c69f1 (diff)
parent7dcb91bd06e79331208c2bcb6849115cac83cedb (diff)
downloadgitlab-ce-e91dc8f4badfdb4742d1662f34edd85f43fb317f.tar.gz
Merge branch '51375-fix-activity-pages' into 'master'
Fix the group and project activity pages Closes #51375 See merge request gitlab-org/gitlab-ce!21674
Diffstat (limited to 'spec')
-rw-r--r--spec/features/projects/activity/user_sees_private_activity_spec.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/features/projects/activity/user_sees_private_activity_spec.rb b/spec/features/projects/activity/user_sees_private_activity_spec.rb
new file mode 100644
index 00000000000..d7dc0a6712a
--- /dev/null
+++ b/spec/features/projects/activity/user_sees_private_activity_spec.rb
@@ -0,0 +1,35 @@
+require 'spec_helper'
+
+describe 'Project > Activity > User sees private activity', :js do
+ let(:project) { create(:project, :public) }
+ let(:author) { create(:user) }
+ let(:user) { create(:user) }
+ let(:issue) { create(:issue, :confidential, project: project, author: author) }
+ let(:message) { "#{author.name} opened issue #{issue.to_reference}" }
+
+ before do
+ project.add_developer(author)
+
+ create(:event, :created, project: project, target: issue, author: author)
+ end
+
+ it 'shows the activity to a logged-in user with permissions' do
+ sign_in(author)
+ visit activity_project_path(project)
+
+ expect(page).to have_content(message)
+ end
+
+ it 'hides the activity from a logged-in user without permissions' do
+ sign_in(user)
+ visit activity_project_path(project)
+
+ expect(page).not_to have_content(message)
+ end
+
+ it 'hides the activity from an anonymous user' do
+ visit activity_project_path(project)
+
+ expect(page).not_to have_content(message)
+ end
+end