forked from otwcode/otwarchive
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AO3-6232 Fix referer for support tickets (otwcode#4990)
* AO3-6232 Fix support ticket tests * Fix referer using hidden field * Shh Rubocop The message I get is about a param, but that's not what happens here. I think Rubocop is confused, and to be honest I disagree that the code is ambiguous. * Fix test name
- Loading branch information
1 parent
ab948f3
commit b454d64
Showing
5 changed files
with
50 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
Given "Zoho ticket creation is enabled" do | ||
allow_any_instance_of(Feedback).to receive(:zoho_enabled?).and_return(true) | ||
WebMock.stub_request(:get, %r{/contacts/search}) | ||
.to_return(headers: { content_type: "application/json" }, body: '{"data":[{"id":"1"}]}') | ||
WebMock.stub_request(:post, %r{/tickets}) | ||
.to_return(headers: { content_type: "application/json" }, body: '{"id":"3"}') | ||
end | ||
|
||
Given "{string} is a permitted Archive host" do |host| | ||
allow(ArchiveConfig).to receive(:PERMITTED_HOSTS).and_return([host]) | ||
end | ||
|
||
Then "a Zoho ticket should be created with referer {string}" do |referer| | ||
# rubocop:disable Lint/AmbiguousBlockAssociation | ||
expect(WebMock).to have_requested(:post, "https://desk.zoho.com/api/v1/tickets") | ||
.with { |req| JSON.parse(req.body)["cf"]["cf_url"] == referer } | ||
# rubocop:enable Lint/AmbiguousBlockAssociation | ||
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