Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Explicitly build options for tests, will be needed next

  • Loading branch information...
commit d127328c3334c16d445a19bdfd1ec5840d2312b7 1 parent 04ced70
@tkareine tkareine authored
Showing with 8 additions and 6 deletions.
  1. +8 −6 test/spec_rack_try_static.rb
View
14 test/spec_rack_try_static.rb
@@ -4,12 +4,14 @@
require 'rack/contrib/try_static'
require 'rack/mock'
-def request(options = {})
- options.merge!({
+def build_options(opts)
+ {
:urls => %w[/],
:root => ::File.expand_path(::File.dirname(__FILE__)),
- })
+ }.merge(opts)
+end
+def request(options = {})
@request =
Rack::MockRequest.new(
Rack::TryStatic.new(
@@ -20,7 +22,7 @@ def request(options = {})
describe "Rack::TryStatic" do
context 'when file cannot be found' do
it 'should call call app' do
- res = request(:try => ['html']).get('/documents')
+ res = request(build_options(:try => ['html'])).get('/documents')
res.should.be.ok
res.body.should == "Hello World"
end
@@ -28,7 +30,7 @@ def request(options = {})
context 'when file can be found' do
it 'should serve first found' do
- res = request(:try => ['.html', '/index.html', '/index.htm']).get('/documents')
+ res = request(build_options(:try => ['.html', '/index.html', '/index.htm'])).get('/documents')
res.should.be.ok
res.body.strip.should == "index.html"
end
@@ -36,7 +38,7 @@ def request(options = {})
context 'when path_info maps directly to file' do
it 'should serve existing' do
- res = request(:try => ['/index.html']).get('/documents/existing.html')
+ res = request(build_options(:try => ['/index.html'])).get('/documents/existing.html')
res.should.be.ok
res.body.strip.should == "existing.html"
end
Please sign in to comment.
Something went wrong with that request. Please try again.