File: fix-shared-different-scheme.patch

package info (click to toggle)
ruby-webmock 3.26.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,196 kB
  • sloc: ruby: 12,859; makefile: 6
file content (30 lines) | stat: -rw-r--r-- 1,590 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Description: Fix test suite failures when HTTP_STATUS_SERVICE defaults to https
 The patch makes the scheme flip always produce the opposite protocol, so the test
 intent is preserved regardless of whether the service URL starts with http:// or
 https://.
Author: Simon Quigley <tsimonq2@debian.org>
Origin: vendor
Forwarded: not-needed
Last-Update: 2026-02-23
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/spec/acceptance/shared/allowing_and_disabling_net_connect.rb
+++ b/spec/acceptance/shared/allowing_and_disabling_net_connect.rb
@@ -185,10 +185,14 @@ shared_context "allowing and disabling n
           end
 
           it "should raise exception if request was made to different scheme" do
-            https_scheme = HTTP_STATUS_SERVICE.sub(%r{^http://}, 'https://')
+            different_scheme = if HTTP_STATUS_SERVICE.start_with?("http://")
+                                 HTTP_STATUS_SERVICE.sub(%r{^http://}, 'https://')
+                               else
+                                 HTTP_STATUS_SERVICE.sub(%r{^https://}, 'http://')
+                               end
             expect {
-              http_request(:get, "#{https_scheme}/")
-            }.to raise_error(WebMock::NetConnectNotAllowedError, %r(Real HTTP connections are disabled. Unregistered request: GET #{https_scheme}))
+              http_request(:get, "#{different_scheme}/")
+            }.to raise_error(WebMock::NetConnectNotAllowedError, %r(Real HTTP connections are disabled. Unregistered request: GET #{different_scheme}))
           end
         end