-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #996 from alphagov/update-create-support-ticket
Update create support ticket endpoint
- Loading branch information
Showing
4 changed files
with
59 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,33 +16,47 @@ | |
end | ||
end | ||
|
||
describe SupportTicket, "#attributes" do | ||
describe SupportTicket, "#zendesk_ticket_attributes" do | ||
it "generates a hash of attributes to create a Zendesk ticket" do | ||
support_ticket = described_class.new( | ||
subject: "Feedback for app", | ||
tags: %w[app_name], | ||
description: "Ticket details go here.", | ||
priority: "normal", | ||
requester: { "locale_id" => 1, "email" => "[email protected]", "name" => "Some user" }, | ||
collaborators: %w[[email protected] [email protected]], | ||
tags: %w[app_name], | ||
custom_fields: [ | ||
{ "id" => 7_948_652_819_356, "value" => "cr_inaccuracy" }, | ||
{ "id" => 7_949_106_580_380, "value" => "cr_benefits" }, | ||
], | ||
ticket_form_id: 123, | ||
) | ||
|
||
expect(support_ticket.attributes).to eq( | ||
expect(support_ticket.zendesk_ticket_attributes).to eq( | ||
"subject" => "Feedback for app", | ||
"tags" => %w[app_name], | ||
"comment" => { | ||
"body" => "Ticket details go here.", | ||
}, | ||
"priority" => "normal", | ||
"requester" => { "locale_id" => 1, "email" => "[email protected]", "name" => "Some user" }, | ||
"collaborators" => %w[[email protected] [email protected]], | ||
"tags" => %w[app_name], | ||
"custom_fields" => [ | ||
{ "id" => 7_948_652_819_356, "value" => "cr_inaccuracy" }, | ||
{ "id" => 7_949_106_580_380, "value" => "cr_benefits" }, | ||
], | ||
"ticket_form_id" => 123, | ||
) | ||
end | ||
|
||
it "generates a hash of attributes where the body omits the optional user agent" do | ||
it "generates a hash of attributes and omits the optional attributes if value was not provided" do | ||
support_ticket = described_class.new( | ||
subject: "Feedback for app", | ||
tags: %w[app_name], | ||
description: "Ticket details go here.", | ||
) | ||
|
||
expect(support_ticket.attributes).to eq( | ||
expect(support_ticket.zendesk_ticket_attributes).to eq( | ||
"subject" => "Feedback for app", | ||
"tags" => %w[app_name], | ||
"comment" => { | ||
"body" => "Ticket details go here.", | ||
}, | ||
|
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 |
---|---|---|
|
@@ -9,6 +9,14 @@ | |
subject: "Feedback for app", | ||
tags: %w[app_name], | ||
description: "Ticket details go here.", | ||
priority: "normal", | ||
requester: { locale_id: 1, email: "[email protected]", name: "Some user" }, | ||
collaborators: %w[[email protected] [email protected]], | ||
custom_fields: [ | ||
{ id: 7_948_652_819_356, value: "cr_inaccuracy" }, | ||
{ id: 7_949_106_580_380, value: "cr_benefits" }, | ||
], | ||
ticket_form_id: 123, | ||
} | ||
|
||
expect(response.code).to eq("201") | ||
|
@@ -28,13 +36,14 @@ | |
params: { | ||
subject: "Feedback for app", | ||
tags: %w[app_name], | ||
requester: { locale_id: 1, email: "[email protected]", name: "Some user" }, | ||
description: "Ticket details go here.", | ||
} | ||
|
||
expect(zendesk_request).to have_been_made | ||
end | ||
|
||
it "responds unsuccessfully if the feedback isn't valid" do | ||
it "responds unsuccessfully if the support ticket isn't valid" do | ||
post "/support-tickets", | ||
params: { subject: "Feedback for app" } | ||
|
||
|