2019-01-21 17:17:18 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2019-09-02 13:28:39 +00:00
|
|
|
require 'system/examples/text_modules_examples'
|
2019-07-03 16:14:28 +00:00
|
|
|
|
2019-01-21 17:17:18 +00:00
|
|
|
RSpec.describe 'Ticket Create', type: :system do
|
|
|
|
context 'when applying ticket templates' do
|
2020-04-30 15:38:57 +00:00
|
|
|
let(:agent) { create(:agent_user, groups: [permitted_group]) }
|
|
|
|
let(:permitted_group) { create(:group) }
|
|
|
|
let(:unpermitted_group) { create(:group) }
|
|
|
|
let!(:template) { create(:template, :dummy_data, group: unpermitted_group, owner: agent) }
|
2019-01-21 17:17:18 +00:00
|
|
|
|
2020-04-30 15:38:57 +00:00
|
|
|
# Regression test for issue #2424 - Unavailable ticket template attributes get applied
|
|
|
|
it 'unavailable attributes do not get applied', authenticated: -> { agent } do
|
2019-01-21 17:17:18 +00:00
|
|
|
visit 'ticket/create'
|
2019-02-04 06:56:18 +00:00
|
|
|
|
2020-04-30 15:38:57 +00:00
|
|
|
use_template(template)
|
2019-01-21 17:17:18 +00:00
|
|
|
expect(page).not_to have_selector 'select[name="group_id"]'
|
|
|
|
end
|
|
|
|
end
|
2019-07-03 16:14:28 +00:00
|
|
|
|
|
|
|
context 'when using text modules' do
|
2019-09-02 13:28:39 +00:00
|
|
|
include_examples 'text modules', path: 'ticket/create'
|
2019-07-03 16:14:28 +00:00
|
|
|
end
|
2019-01-21 17:17:18 +00:00
|
|
|
end
|