remi-rackbox 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION.yml +1 -1
  2. data/lib/rackbox/matchers.rb +8 -1
  3. metadata +1 -1
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
+ :patch: 1
2
3
  :major: 1
3
4
  :minor: 0
4
- :patch: 0
@@ -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
- response['Location'] == url
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remi-rackbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - remi