2019-07-25 05:24:42 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-09-11 16:40:44 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-16 18:09:01 +00:00
|
|
|
RSpec.describe 'Project > Activity > User sees private activity', :js do
|
2018-09-11 16:40:44 +00:00
|
|
|
let(:project) { create(:project, :public) }
|
|
|
|
let(:author) { create(:user) }
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:issue) { create(:issue, :confidential, project: project, author: author) }
|
2018-11-06 14:33:42 +00:00
|
|
|
let(:message) { "#{author.name} #{author.to_reference} opened issue #{issue.to_reference}" }
|
2018-09-11 16:40:44 +00:00
|
|
|
|
|
|
|
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
|