Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed #2424 - Unavailable ticket template attributes get applied
- Loading branch information
1 parent
a159eaf
commit 74ec891
Showing
7 changed files
with
125 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FactoryBot.define do | ||
factory :template do | ||
name { Faker::Name.unique.name } | ||
options { {} } | ||
updated_by_id { 1 } | ||
created_by_id { 1 } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe 'Ticket Create', type: :system do | ||
context 'when applying ticket templates' do | ||
# Regression test for issue #2424 - Unavailable ticket template attributes get applied | ||
scenario 'unavailable attributes do not get applied', authenticated: false do | ||
# create a new agent with permissions for only group "some group1" | ||
user = create :agent_user | ||
user.group_names_access_map = { | ||
'some group1' => 'full', | ||
} | ||
|
||
# create a template that sets the group to Users and ticket owner to user id 1 | ||
template = create :template, options: { | ||
'title' => 'Template Title', | ||
'group_id' => '1', | ||
'owner_id' => '2', | ||
} | ||
|
||
# apply the ticket template and confirm that the group_id dropdown does not appear | ||
login( | ||
username: user.email, | ||
password: 'test', | ||
) | ||
visit 'ticket/create' | ||
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 | ||
end |