Sha256: a631de51e6bd4fa70f7b016bc50edcb47d95c41601e5dd6cd3600f9001f026e6
Contents?: true
Size: 1.13 KB
Versions: 3
Compression:
Stored size: 1.13 KB
Contents
require 'test/spec' require 'rack/cascade' require 'rack/mock' require 'rack/urlmap' require 'rack/file' context "Rack::Cascade" do docroot = File.expand_path(File.dirname(__FILE__)) app1 = Rack::File.new(docroot) app2 = Rack::URLMap.new("/crash" => lambda { |env| raise "boom" }) app3 = Rack::URLMap.new("/foo" => lambda { |env| [200, { "Content-Type" => "text/plain"}, [""]]}) specify "should dispatch onward on 404 by default" do cascade = Rack::Cascade.new([app1, app2, app3]) Rack::MockRequest.new(cascade).get("/cgi/test").should.be.ok Rack::MockRequest.new(cascade).get("/foo").should.be.ok Rack::MockRequest.new(cascade).get("/toobad").should.be.not_found Rack::MockRequest.new(cascade).get("/cgi/../bla").should.be.forbidden end specify "should dispatch onward on whatever is passed" do cascade = Rack::Cascade.new([app1, app2, app3], [404, 403]) Rack::MockRequest.new(cascade).get("/cgi/../bla").should.be.not_found end specify "should fail if empty" do lambda { Rack::MockRequest.new(Rack::Cascade.new([])).get("/") }. should.raise(ArgumentError) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rack-0.2.0 | test/spec_rack_cascade.rb |
rack-0.3.0 | test/spec_rack_cascade.rb |
rack-0.1.0 | test/spec_rack_cascade.rb |