Bacon_Rack 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -29,7 +29,7 @@ module Bacon_Rack
29
29
 
30
30
  status.should.include last_response.status
31
31
 
32
- last_response['Location'].sub(%r!http://(www.)?example\.com!, '')
32
+ last_response['Location'].sub(File.join(last_request.env['SERVER_NAME'],'/'), '/')
33
33
  .should == path
34
34
  end
35
35
 
@@ -1 +1 @@
1
- Bacon_Rack_Version = "0.2.0"
1
+ Bacon_Rack_Version = "0.2.1"
data/spec/Bacon_Rack.rb CHANGED
@@ -28,14 +28,13 @@ describe ":redirects_to" do
28
28
  }
29
29
  end
30
30
 
31
- %w{ example.com www.example.com }.each { |str|
32
- it "ignores http://#{str} host in location header" do
33
- last_response.status = 301
34
- last_response['Location'] = "http://#{str}/new"
35
-
36
- redirects_to '/new'
37
- end
38
- }
31
+ it "ignores SERVER_NAME in location header" do
32
+ last_request.env['SERVER_NAME'] = "http://random.org/"
33
+ last_response.status = 301
34
+ last_response['Location'] = "http://random.org/new"
35
+
36
+ redirects_to '/new'
37
+ end
39
38
 
40
39
  it "accepts both a status and path" do
41
40
  last_response.status = 303
data/spec/lib/main.rb CHANGED
@@ -26,6 +26,17 @@ require 'pry'
26
26
 
27
27
  class Bacon::Context
28
28
 
29
+ def last_request
30
+ @o ||= begin
31
+ new_o = Object.new
32
+ def new_o.env
33
+ @h ||= Hash['SERVER_NAME'=>'http://www.example.org']
34
+ end
35
+ new_o
36
+ end
37
+ @o
38
+ end
39
+
29
40
  def last_response
30
41
  @fake_rack ||= Fake_Rack.new
31
42
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Bacon_Rack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-12 00:00:00.000000000 Z
12
+ date: 2012-05-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bacon