redirect 0.4.0 → 0.4.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.
@@ -68,11 +68,11 @@ module Redirect
68
68
  end
69
69
 
70
70
  def index_file
71
- @index_file ||= StaticFile.new(File.join(public_dir_path, 'index.html'))
71
+ @index_file = StaticFile.new(File.join(public_dir_path, 'index.html'))
72
72
  end
73
73
 
74
74
  def public_dir_path
75
- @public_dir_path ||= File.expand_path(public_dir)
75
+ @public_dir_path = File.expand_path(public_dir)
76
76
  end
77
77
 
78
78
  def not_found_response
@@ -112,7 +112,7 @@ module Redirect
112
112
  end
113
113
 
114
114
  def static_file
115
- @static_file ||= StaticFile.new(public_dir_path + URI.unescape(request.path_info))
115
+ @static_file = StaticFile.new(public_dir_path + URI.unescape(request.path_info))
116
116
  end
117
117
 
118
118
  def static_response
@@ -1,3 +1,3 @@
1
1
  module Redirect
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
@@ -98,7 +98,7 @@ describe "Redirect::App" do
98
98
  context "basic redirect" do
99
99
  let(:res) do
100
100
  @app = Redirect::App.new(['/old/2008', '/index.html'])
101
- get('/old/2008')
101
+ get '/old/2008'
102
102
  end
103
103
 
104
104
  it "sets the content-type header to text/html" do
@@ -114,11 +114,21 @@ describe "Redirect::App" do
114
114
  end
115
115
  end
116
116
 
117
+ it "can handle the redirected response" do
118
+ @app = Redirect::App.new(['/old/2008', '/index.html'])
119
+ @app.public_dir = 'spec/fixtures/public'
120
+ get '/old/2008'
121
+ status.should == 301
122
+ get '/index.html'
123
+ status.should == 200
124
+ body.should == File.read('spec/fixtures/public/index.html')
125
+ end
126
+
117
127
  it "renders the redirect if available" do
118
128
  @app = Redirect::App.new(['/old/2008', '/index.html'])
119
129
  @app.public_dir = 'spec/fixtures/public'
120
130
  get '/index.html'
121
- # status.should == 200
131
+ status.should == 200
122
132
  body.should == File.read('spec/fixtures/public/index.html')
123
133
  end
124
134
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: redirect
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.4.0
5
+ version: 0.4.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Petrik de Heus