remi-rackbox 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION.yml +1 -1
- data/lib/rackbox/matchers.rb +8 -1
- metadata +1 -1
data/VERSION.yml
CHANGED
data/lib/rackbox/matchers.rb
CHANGED
@@ -10,7 +10,14 @@ module RackBox::Matchers
|
|
10
10
|
# the actual matcher logic
|
11
11
|
matcher(:redirect_to, base) do |response, url|
|
12
12
|
return false unless response['Location']
|
13
|
-
|
13
|
+
if url =~ /^\//
|
14
|
+
# looking for a relative match, eg. should redirect_to('/login')
|
15
|
+
relative_location = response['Location'].sub(/^https?:\/\//,'').sub(/^[^\/]*/,'')
|
16
|
+
# ^ there's probably a helper on Rack or CGI to do this
|
17
|
+
relative_location.downcase == url.downcase
|
18
|
+
else
|
19
|
+
response['Location'].downcase == url.downcase
|
20
|
+
end
|
14
21
|
end
|
15
22
|
|
16
23
|
end
|