Commit 02b1a1f4 authored by Felipe Artur's avatar Felipe Artur Committed by Robert Speicher

Extract EE specific files/lines for spec/features/issues

Part of moving gitlab into single codebase
parent 7ee640ff
# frozen_string_literal: true
require 'rails_helper'
describe 'Issues > User uses quick actions', :js do
include Spec::Support::Helpers::Features::NotesHelpers
describe 'issue-only commands' do
let(:user) { create(:user) }
let(:project) { create(:project, :public) }
before do
project.add_maintainer(user)
sign_in(user)
visit project_issue_path(project, issue)
end
after do
wait_for_requests
end
describe 'adding a weight from a note' do
let(:issue) { create(:issue, project: project) }
context 'when the user can update the weight' do
it 'does not create a note, and sets the weight accordingly' do
add_note("/weight 5")
expect(page).not_to have_content '/weight 5'
expect(page).to have_content 'Commands applied'
issue.reload
expect(issue.weight).to eq(5)
end
end
context 'when the current user cannot update the weight' do
let(:guest) { create(:user) }
before do
project.add_guest(guest)
gitlab_sign_out
sign_in(guest)
visit project_issue_path(project, issue)
end
it 'does not create a note or set the weight' do
add_note("/weight 5")
expect(page).not_to have_content 'Commands applied'
issue.reload
expect(issue.weight).not_to eq(5)
end
end
end
describe 'removing weight from a note' do
let(:issue) { create(:issue, project: project, weight: 1) }
context 'when the user can update the weight' do
it 'does not create a note, and removes the weight accordingly' do
add_note("/clear_weight")
expect(page).not_to have_content '/clear_weight'
expect(page).to have_content 'Commands applied'
issue.reload
expect(issue.weight).to eq(nil)
end
end
context 'when the current user cannot update the weight' do
let(:guest) { create(:user) }
before do
project.add_guest(guest)
gitlab_sign_out
sign_in(guest)
visit project_issue_path(project, issue)
end
it 'does create a note or set the weight' do
add_note("/clear_weight")
expect(page).not_to have_content 'Commands applied'
issue.reload
expect(issue.weight).to eq(1)
end
end
end
end
end
# frozen_string_literal: true
require 'rails_helper'
describe 'Issues > User uses quick actions', :js do
......@@ -62,116 +64,6 @@ describe 'Issues > User uses quick actions', :js do
it_behaves_like 'create_merge_request quick action'
it_behaves_like 'due quick action'
describe 'adding a weight from a note' do
let(:issue) { create(:issue, project: project) }
context 'when the user can update the weight' do
it 'does not create a note, and sets the weight accordingly' do
add_note("/weight 5")
expect(page).not_to have_content '/weight 5'
expect(page).to have_content 'Commands applied'
issue.reload
expect(issue.weight).to eq(5)
end
end
context 'when the current user cannot update the weight' do
let(:guest) { create(:user) }
before do
project.add_guest(guest)
gitlab_sign_out
sign_in(guest)
visit project_issue_path(project, issue)
end
it 'does not create a note or set the weight' do
add_note("/weight 5")
expect(page).not_to have_content 'Commands applied'
issue.reload
expect(issue.weight).not_to eq(5)
end
end
end
describe 'removing weight from a note' do
let(:issue) { create(:issue, project: project, weight: 1) }
context 'when the user can update the weight' do
it 'does not create a note, and removes the weight accordingly' do
add_note("/clear_weight")
expect(page).not_to have_content '/clear_weight'
expect(page).to have_content 'Commands applied'
issue.reload
expect(issue.weight).to eq(nil)
end
end
context 'when the current user cannot update the weight' do
let(:guest) { create(:user) }
before do
project.add_guest(guest)
gitlab_sign_out
sign_in(guest)
visit project_issue_path(project, issue)
end
it 'does create a note or set the weight' do
add_note("/clear_weight")
expect(page).not_to have_content 'Commands applied'
issue.reload
expect(issue.weight).to eq(1)
end
end
end
describe 'mark issue as duplicate' do
let(:issue) { create(:issue, project: project) }
let(:original_issue) { create(:issue, project: project) }
context 'when the current user can update issues' do
it 'does not create a note, and marks the issue as a duplicate' do
add_note("/duplicate ##{original_issue.to_reference}")
expect(page).not_to have_content "/duplicate #{original_issue.to_reference}"
expect(page).to have_content 'Commands applied'
expect(page).to have_content "marked this issue as a duplicate of #{original_issue.to_reference}"
expect(issue.reload).to be_closed
end
end
context 'when the current user cannot update the issue' do
let(:guest) { create(:user) }
before do
project.add_guest(guest)
gitlab_sign_out
sign_in(guest)
visit project_issue_path(project, issue)
end
it 'does not create a note, and does not mark the issue as a duplicate' do
add_note("/duplicate ##{original_issue.to_reference}")
expect(page).not_to have_content 'Commands applied'
expect(page).not_to have_content "marked this issue as a duplicate of #{original_issue.to_reference}"
expect(issue.reload).to be_open
end
end
end
describe 'move the issue to another project' do
let(:issue) { create(:issue, project: project) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment