Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 44 lines (36 sloc) 1.424 kB
ed86dfd @chneukirchen Allow handlers to register themselves with Rack::Handler.
authored
1 require 'test/spec'
2
3 require 'rack/handler'
4
297aee7 @chneukirchen Shuffle scopes for 1.9
authored
5 class Rack::Handler::Lobster; end
6 class RockLobster; end
ed86dfd @chneukirchen Allow handlers to register themselves with Rack::Handler.
authored
7
297aee7 @chneukirchen Shuffle scopes for 1.9
authored
8 context "Rack::Handler" do
ed86dfd @chneukirchen Allow handlers to register themselves with Rack::Handler.
authored
9 specify "has registered default handlers" do
10 Rack::Handler.get('cgi').should.equal Rack::Handler::CGI
11 Rack::Handler.get('fastcgi').should.equal Rack::Handler::FastCGI
12 Rack::Handler.get('mongrel').should.equal Rack::Handler::Mongrel
13 Rack::Handler.get('webrick').should.equal Rack::Handler::WEBrick
14 end
48696df Made auto-registration of unknown handlers much smarter. This should …
Graham Batty authored
15
a38920c Made it so that the expectation is that Handler.get raises NameError …
Graham Batty authored
16 specify "handler that doesn't exist should raise a NameError" do
17 lambda {
18 Rack::Handler.get('boom')
19 }.should.raise(NameError)
48696df Made auto-registration of unknown handlers much smarter. This should …
Graham Batty authored
20 end
ed86dfd @chneukirchen Allow handlers to register themselves with Rack::Handler.
authored
21
48696df Made auto-registration of unknown handlers much smarter. This should …
Graham Batty authored
22 specify "should get unregistered, but already required, handler by name" do
8a7b7ff Simplified options for unregistered handlers
Graham Batty authored
23 Rack::Handler.get('Lobster').should.equal Rack::Handler::Lobster
ed86dfd @chneukirchen Allow handlers to register themselves with Rack::Handler.
authored
24 end
25
26 specify "should register custom handler" do
27 Rack::Handler.register('rock_lobster', 'RockLobster')
28 Rack::Handler.get('rock_lobster').should.equal RockLobster
29 end
48696df Made auto-registration of unknown handlers much smarter. This should …
Graham Batty authored
30
31 specify "should not need registration for properly coded handlers even if not already required" do
32 begin
33 $:.push "test/unregistered_handler"
34 Rack::Handler.get('Unregistered').should.equal Rack::Handler::Unregistered
a38920c Made it so that the expectation is that Handler.get raises NameError …
Graham Batty authored
35 lambda {
36 Rack::Handler.get('UnRegistered')
37 }.should.raise(NameError)
48696df Made auto-registration of unknown handlers much smarter. This should …
Graham Batty authored
38 Rack::Handler.get('UnregisteredLongOne').should.equal Rack::Handler::UnregisteredLongOne
39 ensure
40 $:.delete "test/unregistered_handler"
41 end
42 end
ed86dfd @chneukirchen Allow handlers to register themselves with Rack::Handler.
authored
43 end
Something went wrong with that request. Please try again.