Sha256: be7c6032fe66eebe91d693975c4d43c49fd74dff33c9955e28a9830d5a044a96

Contents?: true

Size: 961 Bytes

Versions: 6

Compression:

Stored size: 961 Bytes

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe Server, 'app builder' do
  it "should build app from constructor" do
    server = Server.new('0.0.0.0', 3000, :works)
    
    server.app.should == :works
  end
  
  it "should build app from builder block" do
    server = Server.new '0.0.0.0', 3000 do
      run(proc { |env| :works })
    end
    
    server.app.call({}).should == :works
  end
  
  it "should use middlewares in builder block" do
    server = Server.new '0.0.0.0', 3000 do
      use Rack::ShowExceptions
      run(proc { |env| :works })
    end
    
    server.app.class.should == Rack::ShowExceptions
    server.app.call({}).should == :works
  end
  
  it "should work with Rack url mapper" do
    server = Server.new '0.0.0.0', 3000 do
      map '/test' do
        run(proc { |env| :works })
      end
    end
    
    server.app.call({})[0].should == 404
    server.app.call({'PATH_INFO' => '/test'}).should == :works
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
thin-0.6.3-x86-mswin32-60 spec/server/builder_spec.rb
thin-0.6.4 spec/server/builder_spec.rb
thin-0.6.4-x86-mswin32-60 spec/server/builder_spec.rb
thin-0.7.0-x86-mswin32-60 spec/server/builder_spec.rb
thin-0.6.3 spec/server/builder_spec.rb
thin-0.7.0 spec/server/builder_spec.rb