Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

file 45 lines (38 sloc) 1.228 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
require 'test/spec'

require 'rack/lobster'
require 'rack/mock'

context "Rack::Lobster::LambdaLobster" do
  specify "should be a single lambda" do
    Rack::Lobster::LambdaLobster.should.be.kind_of Proc
  end
  
  specify "should look like a lobster" do
    res = Rack::MockRequest.new(Rack::Lobster::LambdaLobster).get("/")
    res.should.be.ok
    res.body.should.include "(,(,,(,,,("
    res.body.should.include "?flip"
  end

  specify "should be flippable" do
    res = Rack::MockRequest.new(Rack::Lobster::LambdaLobster).get("/?flip")
    res.should.be.ok
    res.body.should.include "(,,,(,,(,("
  end
end

context "Rack::Lobster" do
  specify "should look like a lobster" do
    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

  specify "should be flippable" do
    res = Rack::MockRequest.new(Rack::Lobster.new).get("/?flip=left")
    res.should.be.ok
    res.body.should.include "(,,,(,,(,("
  end

  specify "should provide crashing for testing purposes" do
    lambda {
      Rack::MockRequest.new(Rack::Lobster.new).get("/?flip=crash")
    }.should.raise
  end
end
Something went wrong with that request. Please try again.