Sha256: 73320c11eef58f74179f809bc31d81e9e3a5ccd59cc8f9e7be5fa6a43cb91975

Contents?: true

Size: 627 Bytes

Versions: 1

Compression:

Stored size: 627 Bytes

Contents

require 'spec_helper'

describe Vx::Lib::Rack::Builder do
  First = Struct.new(:app) do
    def call(env)
      env << 'first.begin'
      app.call(env)
      env << 'first.end'
    end
  end

  Last = Struct.new(:app) do
    def call(env)
      env << 'last.begin'
      app.call(env)
      env << 'last.end'
    end
  end

  let(:builder) {
    described_class.new do
      use First
      use Last
    end
  }

  subject { builder }

  it "should be work" do
    env = []
    app = ->(c){ c << 'run' }
    rs = builder.to_app(app).call env
    expect(rs).to eq %w{ first.begin last.begin run last.end first.end }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vx-lib-rack-builder-0.0.3 spec/lib/builder_spec.rb