2019-01-21 17:17:18 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2019-07-03 16:14:28 +00:00
|
|
|
require 'system/examples/text_modules_group_dependency_examples'
|
|
|
|
|
2019-01-21 17:17:18 +00:00
|
|
|
RSpec.describe 'Ticket Create', type: :system do
|
|
|
|
context 'when applying ticket templates' do
|
|
|
|
# Regression test for issue #2424 - Unavailable ticket template attributes get applied
|
2019-04-15 01:41:17 +00:00
|
|
|
it 'unavailable attributes do not get applied', authenticated: false do
|
2019-02-04 06:56:18 +00:00
|
|
|
user = create(:agent_user)
|
|
|
|
permitted_group = create(:group)
|
|
|
|
unpermitted_group = create(:group)
|
|
|
|
|
2019-01-21 17:17:18 +00:00
|
|
|
user.group_names_access_map = {
|
2019-02-04 06:56:18 +00:00
|
|
|
permitted_group.name => 'full',
|
2019-01-21 17:17:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template = create :template, options: {
|
|
|
|
'title' => 'Template Title',
|
2019-02-04 06:56:18 +00:00
|
|
|
'group_id' => unpermitted_group.id,
|
2019-01-21 17:17:18 +00:00
|
|
|
'owner_id' => '2',
|
|
|
|
}
|
|
|
|
|
|
|
|
login(
|
|
|
|
username: user.email,
|
|
|
|
password: 'test',
|
|
|
|
)
|
|
|
|
visit 'ticket/create'
|
2019-02-04 06:56:18 +00:00
|
|
|
|
|
|
|
# apply the ticket template and confirm that the group_id dropdown does not appear
|
2019-01-21 17:17:18 +00:00
|
|
|
find('#form-template select[name="id"]').find(:option, template.name).select_option
|
|
|
|
click '.sidebar-content .js-apply'
|
|
|
|
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
|
|
|
|
include_examples 'group-dependent text modules', path: 'ticket/create'
|
|
|
|
end
|
2019-01-21 17:17:18 +00:00
|
|
|
end
|