spec_lobster.rb 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. require 'rack/lobster'
  2. require 'rack/mock'
  3. describe Rack::Lobster::LambdaLobster do
  4. should "be a single lambda" do
  5. Rack::Lobster::LambdaLobster.should.be.kind_of Proc
  6. end
  7. should "look like a lobster" do
  8. res = Rack::MockRequest.new(Rack::Lobster::LambdaLobster).get("/")
  9. res.should.be.ok
  10. res.body.should.include "(,(,,(,,,("
  11. res.body.should.include "?flip"
  12. end
  13. should "be flippable" do
  14. res = Rack::MockRequest.new(Rack::Lobster::LambdaLobster).get("/?flip")
  15. res.should.be.ok
  16. res.body.should.include "(,,,(,,(,("
  17. end
  18. end
  19. describe Rack::Lobster do
  20. should "look like a lobster" do
  21. res = Rack::MockRequest.new(Rack::Lobster.new).get("/")
  22. res.should.be.ok
  23. res.body.should.include "(,(,,(,,,("
  24. res.body.should.include "?flip"
  25. res.body.should.include "crash"
  26. end
  27. should "be flippable" do
  28. res = Rack::MockRequest.new(Rack::Lobster.new).get("/?flip=left")
  29. res.should.be.ok
  30. res.body.should.include "(,,,(,,(,("
  31. end
  32. should "provide crashing for testing purposes" do
  33. lambda {
  34. Rack::MockRequest.new(Rack::Lobster.new).get("/?flip=crash")
  35. }.should.raise
  36. end
  37. end