Sha256: 7117707157a2e86a3dbd44358c1882c35322130e727cfc850b317e3fdf9b362c

Contents?: true

Size: 643 Bytes

Versions: 2

Compression:

Stored size: 643 Bytes

Contents

require File.expand_path("helper", File.dirname(__FILE__))

class Shrimp
  def initialize(app)
    @app = app
  end

  def call(env)
    status, headers, resp = @app.call(env)

    [status, headers, resp.body.reverse]
  end
end

test do
  class API < Cuba
    use Shrimp

    define do
      on "v1/test" do
        res.write "OK"
        res.write "1"
        res.write "2"
      end
    end
  end

  Cuba.define do
    on "api" do
      run API
    end
  end

  _, _, body = Cuba.call({ "PATH_INFO" => "/api/v1/test", "SCRIPT_NAME" => "/" })

  arr = []

  body.each do |line|
    arr << line
  end

  assert_equal ["2", "1", "OK"], arr
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cuba-3.0.0.rc2 test/middleware.rb
cuba-3.0.0.rc1 test/middleware.rb