Skip to content

Commit 2e37587

Browse files
committed
let's try keeping it split
1 parent 97bf933 commit 2e37587

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

app/models/feedback_reporters/support_reporter.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def custom_zoho_fields
1616
# To avoid issues where Zoho ticket creation silently fails, only grab the first
1717
# 2080 characters of the referer URL. That may miss some complex search queries,
1818
# but still keep enough to be useful most of the time.
19-
truncated_referer = url.present? ? url[0..2079] : ""
19+
truncated_referer = referer.present? ? referer[0..2079] : ""
2020
{
2121
"cf_archive_version" => site_revision.presence || "Unknown site revision",
2222
"cf_rollout" => rollout.presence || "Unknown",

features/other_b/support.feature

+4-4
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Feature: Filing a support request
6161
And the email should not contain "<img src="http://www.example.org/foo.jpg" />"
6262
But the email should contain "http://www.example.org/foo.jpgHi"
6363

64-
Scenario: Submit a request with an on-Archive referer URL
64+
Scenario: Submit a request with an on-Archive referer
6565

6666
Given I am logged in as "puzzled"
6767
And basic languages
@@ -72,9 +72,9 @@ Feature: Filing a support request
7272
And I fill in "Brief summary" with "Just a brief note"
7373
And I fill in "Your question or problem" with "Hi, I came from the Archive"
7474
And I press "Send"
75-
Then a Zoho ticket should be created with url "http://www.example.com/works"
75+
Then a Zoho ticket should be created with referer "http://www.example.com/works"
7676

77-
Scenario: Submit a request with a referer URL that is not on-Archive
77+
Scenario: Submit a request with a referer that is not on-Archive
7878

7979
Given I am logged in as "puzzled"
8080
And basic languages
@@ -84,4 +84,4 @@ Feature: Filing a support request
8484
And I fill in "Brief summary" with "Just a brief note"
8585
And I fill in "Your question or problem" with "Hi, I didn't come from the Archive"
8686
And I press "Send"
87-
Then a Zoho ticket should be created with url ""
87+
Then a Zoho ticket should be created with referer ""

features/step_definitions/support_steps.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
allow(ArchiveConfig).to receive(:PERMITTED_HOSTS).and_return([host])
1313
end
1414

15-
Then "a Zoho ticket should be created with url {string}" do |url|
15+
Then "a Zoho ticket should be created with referer {string}" do |referer|
1616
# rubocop:disable Lint/AmbiguousBlockAssociation
1717
expect(WebMock).to have_requested(:post, "https://desk.zoho.com/api/v1/tickets")
18-
.with { |req| JSON.parse(req.body)["cf"]["cf_ticket_url"] == url }
18+
.with { |req| JSON.parse(req.body)["cf"]["cf_ticket_url"] == referer }
1919
# rubocop:enable Lint/AmbiguousBlockAssociation
2020
end

spec/models/feedback_reporters/support_reporter_spec.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
site_revision: "eternal_beta",
1717
rollout: "rollout_value",
1818
ip_address: "127.0.0.1",
19-
url: "https://example.com/works/1",
19+
referer: "https://example.com/works/1",
2020
site_skin: build(:skin, title: "Reversi", public: true)
2121
}
2222
end
@@ -116,17 +116,17 @@
116116

117117
context "if the report has an empty URL" do
118118
before do
119-
allow(subject).to receive(:url).and_return("")
119+
allow(subject).to receive(:referer).and_return("")
120120
end
121121

122-
it "returns a hash containing a blank string for URL" do
122+
it "returns a hash containing a blank string for referer" do
123123
expect(subject.report_attributes.dig("cf", "cf_ticket_url")).to eq("")
124124
end
125125
end
126126

127-
context "if the reporter has a very long URL" do
127+
context "if the reporter has a very long referer URL" do
128128
before do
129-
allow(subject).to receive(:url).and_return("a" * 2081)
129+
allow(subject).to receive(:referer).and_return("a" * 2081)
130130
end
131131

132132
it "truncates the URL to 2080 characters" do

0 commit comments

Comments
 (0)