2018-04-03 06:27:56 -04:00
|
|
|
require "spec_helper"
|
|
|
|
|
|
|
|
describe "User views issue" do
|
2018-11-12 03:40:56 -05:00
|
|
|
let(:project) { create(:project_empty_repo, :public) }
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:issue) { create(:issue, project: project, description: "# Description header", author: user) }
|
2018-04-03 06:27:56 -04:00
|
|
|
|
|
|
|
before do
|
2018-04-10 13:49:26 -04:00
|
|
|
project.add_developer(user)
|
2018-04-03 06:27:56 -04:00
|
|
|
sign_in(user)
|
|
|
|
|
|
|
|
visit(project_issue_path(project, issue))
|
|
|
|
end
|
|
|
|
|
|
|
|
it { expect(page).to have_header_with_correct_id_and_link(1, "Description header", "description-header") }
|
2018-04-10 13:49:26 -04:00
|
|
|
|
2018-04-11 17:14:02 -04:00
|
|
|
it 'shows the merge request and issue actions', :aggregate_failures do
|
|
|
|
expect(page).to have_link('New issue')
|
|
|
|
expect(page).to have_button('Create merge request')
|
|
|
|
expect(page).to have_link('Close issue')
|
|
|
|
end
|
2018-04-10 13:49:26 -04:00
|
|
|
|
|
|
|
context 'when the project is archived' do
|
2018-04-11 17:14:02 -04:00
|
|
|
let(:project) { create(:project, :public, :archived) }
|
2018-04-10 13:49:26 -04:00
|
|
|
|
2018-04-11 17:14:02 -04:00
|
|
|
it 'hides the merge request and issue actions', :aggregate_failures do
|
|
|
|
expect(page).not_to have_link('New issue')
|
|
|
|
expect(page).not_to have_button('Create merge request')
|
|
|
|
expect(page).not_to have_link('Close issue')
|
|
|
|
end
|
2018-04-10 13:49:26 -04:00
|
|
|
end
|
2018-07-16 12:18:52 -04:00
|
|
|
|
|
|
|
describe 'user status' do
|
|
|
|
subject { visit(project_issue_path(project, issue)) }
|
|
|
|
|
|
|
|
describe 'showing status of the author of the issue' do
|
|
|
|
it_behaves_like 'showing user status' do
|
|
|
|
let(:user_with_status) { issue.author }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'showing status of a user who commented on an issue', :js do
|
|
|
|
let!(:note) { create(:note, noteable: issue, project: project, author: user_with_status) }
|
|
|
|
|
|
|
|
it_behaves_like 'showing user status' do
|
|
|
|
let(:user_with_status) { create(:user) }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2018-04-03 06:27:56 -04:00
|
|
|
end
|