2009-12-19 03:16:58 +01:00
|
|
|
require 'rack/lobster'
|
|
|
|
require 'rack/mock'
|
|
|
|
|
2010-06-14 06:09:24 +02:00
|
|
|
describe Rack::Lobster::LambdaLobster do
|
|
|
|
should "be a single lambda" do
|
2009-12-19 03:16:58 +01:00
|
|
|
Rack::Lobster::LambdaLobster.should.be.kind_of Proc
|
|
|
|
end
|
2010-06-14 06:09:24 +02:00
|
|
|
|
|
|
|
should "look like a lobster" do
|
2009-12-19 03:16:58 +01:00
|
|
|
res = Rack::MockRequest.new(Rack::Lobster::LambdaLobster).get("/")
|
|
|
|
res.should.be.ok
|
|
|
|
res.body.should.include "(,(,,(,,,("
|
|
|
|
res.body.should.include "?flip"
|
|
|
|
end
|
|
|
|
|
2010-06-14 06:09:24 +02:00
|
|
|
should "be flippable" do
|
2009-12-19 03:16:58 +01:00
|
|
|
res = Rack::MockRequest.new(Rack::Lobster::LambdaLobster).get("/?flip")
|
|
|
|
res.should.be.ok
|
|
|
|
res.body.should.include "(,,,(,,(,("
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-06-14 06:09:24 +02:00
|
|
|
describe Rack::Lobster do
|
|
|
|
should "look like a lobster" do
|
2009-12-19 03:16:58 +01:00
|
|
|
res = Rack::MockRequest.new(Rack::Lobster.new).get("/")
|
|
|
|
res.should.be.ok
|
|
|
|
res.body.should.include "(,(,,(,,,("
|
|
|
|
res.body.should.include "?flip"
|
|
|
|
res.body.should.include "crash"
|
|
|
|
end
|
|
|
|
|
2010-06-14 06:09:24 +02:00
|
|
|
should "be flippable" do
|
2009-12-19 03:16:58 +01:00
|
|
|
res = Rack::MockRequest.new(Rack::Lobster.new).get("/?flip=left")
|
|
|
|
res.should.be.ok
|
|
|
|
res.body.should.include "(,,,(,,(,("
|
|
|
|
end
|
|
|
|
|
2010-06-14 06:09:24 +02:00
|
|
|
should "provide crashing for testing purposes" do
|
2009-12-19 03:16:58 +01:00
|
|
|
lambda {
|
|
|
|
Rack::MockRequest.new(Rack::Lobster.new).get("/?flip=crash")
|
|
|
|
}.should.raise
|
|
|
|
end
|
|
|
|
end
|