Fixed CI failures on Circle CI introduced by commit 8f04e32
. This is a follow-up to original issue #2534 - Agents should always be able to re-open closed tickets, regardless of group.follow_up_possible.
This commit is contained in:
parent
c16c86e99e
commit
d4b0d953d0
1 changed files with 26 additions and 12 deletions
|
@ -2088,6 +2088,7 @@ RSpec.describe 'Ticket', type: :request do # rubocop:disable Metrics/BlockLength
|
||||||
describe 'reopening a ticket' do
|
describe 'reopening a ticket' do
|
||||||
shared_examples 'successfully reopen a ticket' do
|
shared_examples 'successfully reopen a ticket' do
|
||||||
it 'succeeds' do
|
it 'succeeds' do
|
||||||
|
authenticated_as(user)
|
||||||
put "/api/v1/tickets/#{ticket.id}",
|
put "/api/v1/tickets/#{ticket.id}",
|
||||||
params: { state_id: Ticket::State.find_by(name: 'open').id },
|
params: { state_id: Ticket::State.find_by(name: 'open').id },
|
||||||
as: :json
|
as: :json
|
||||||
|
@ -2099,6 +2100,7 @@ RSpec.describe 'Ticket', type: :request do # rubocop:disable Metrics/BlockLength
|
||||||
|
|
||||||
shared_examples 'fail to reopen a ticket' do
|
shared_examples 'fail to reopen a ticket' do
|
||||||
it 'fails' do
|
it 'fails' do
|
||||||
|
authenticated_as(user)
|
||||||
put "/api/v1/tickets/#{ticket.id}",
|
put "/api/v1/tickets/#{ticket.id}",
|
||||||
params: { state_id: Ticket::State.find_by(name: 'open').id },
|
params: { state_id: Ticket::State.find_by(name: 'open').id },
|
||||||
as: :json
|
as: :json
|
||||||
|
@ -2111,32 +2113,44 @@ RSpec.describe 'Ticket', type: :request do # rubocop:disable Metrics/BlockLength
|
||||||
context 'when ticket.group.follow_up_possible = "yes"' do
|
context 'when ticket.group.follow_up_possible = "yes"' do
|
||||||
before { ticket.group.update(follow_up_possible: 'yes') }
|
before { ticket.group.update(follow_up_possible: 'yes') }
|
||||||
|
|
||||||
context 'as admin', authenticated_as: :admin do
|
context 'as admin' do
|
||||||
include_examples 'successfully reopen a ticket'
|
include_examples 'successfully reopen a ticket' do
|
||||||
|
let(:user) { admin }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'as agent', authenticated_as: :agent do
|
context 'as agent' do
|
||||||
include_examples 'successfully reopen a ticket'
|
include_examples 'successfully reopen a ticket' do
|
||||||
|
let(:user) { agent }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'as customer', authenticated_as: :customer do
|
context 'as customer' do
|
||||||
include_examples 'successfully reopen a ticket'
|
include_examples 'successfully reopen a ticket' do
|
||||||
|
let(:user) { customer }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when ticket.group.follow_up_possible = "new_ticket"' do
|
context 'when ticket.group.follow_up_possible = "new_ticket"' do
|
||||||
before { ticket.group.update(follow_up_possible: 'new_ticket') }
|
before { ticket.group.update(follow_up_possible: 'new_ticket') }
|
||||||
|
|
||||||
context 'as admin', authenticated_as: :admin do
|
context 'as admin' do
|
||||||
include_examples 'successfully reopen a ticket'
|
include_examples 'successfully reopen a ticket' do
|
||||||
|
let(:user) { admin }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'as agent', authenticated_as: :agent do
|
context 'as agent' do
|
||||||
include_examples 'successfully reopen a ticket'
|
include_examples 'successfully reopen a ticket' do
|
||||||
|
let(:user) { agent }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'as customer', authenticated_as: :customer do
|
context 'as customer' do
|
||||||
include_examples 'fail to reopen a ticket'
|
include_examples 'fail to reopen a ticket' do
|
||||||
|
let(:user) { customer }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue