Commit 6e0e850 1 parent 6cc1bd9 commit 6e0e850 Copy full SHA for 6e0e850
File tree 2 files changed +18
-6
lines changed
spec/models/feedback_reporters
2 files changed +18
-6
lines changed Original file line number Diff line number Diff line change 72
72
end
73
73
end
74
74
75
- context "if the report does not have an URL" do
76
- it "returns a hash containing 'Unknown URL'" do
77
- allow ( subject ) . to receive ( :url ) . and_return ( "" )
75
+ context "if the report has an empty referer" do
76
+ before do
77
+ allow ( subject ) . to receive ( :referer ) . and_return ( "" )
78
+ end
79
+
80
+ it "returns a hash containing a blank string for referer" do
81
+ expect ( subject . report_attributes . dig ( "cf" , "cf_ticket_url" ) ) . to eq ( "" )
82
+ end
83
+ end
84
+
85
+ context "if the reporter has a very long referer" do
86
+ before do
87
+ allow ( subject ) . to receive ( :referer ) . and_return ( "a" * 2081 )
88
+ end
78
89
79
- expect ( subject . report_attributes . fetch ( "cf" ) . fetch ( "cf_ticket_url" ) ) . to eq ( "Unknown URL" )
90
+ it "truncates the referer to 2080 characters" do
91
+ expect ( subject . report_attributes . dig ( "cf" , "cf_ticket_url" ) . length ) . to eq ( 2080 )
80
92
end
81
93
end
82
94
Original file line number Diff line number Diff line change 120
120
end
121
121
122
122
it "returns a hash containing a blank string for referer" do
123
- expect ( subject . report_attributes . dig ( "cf" , "cf_ticket_url" ) ) . to eq ( "Unknown URL " )
123
+ expect ( subject . report_attributes . dig ( "cf" , "cf_ticket_url" ) ) . to eq ( "" )
124
124
end
125
125
end
126
126
127
127
context "if the reporter has a very long referer" do
128
128
before do
129
- allow ( subject ) . to receive ( :referer ) . and_return ( "a" * 256 )
129
+ allow ( subject ) . to receive ( :referer ) . and_return ( "a" * 2081 )
130
130
end
131
131
132
132
it "truncates the referer to 2080 characters" do
You can’t perform that action at this time.
0 commit comments