Sha256: 18363f76a0222d5e3e8427ad563b2a748e56bf96a769c48acbb51eab11dcea71

Contents?: true

Size: 854 Bytes

Versions: 35

Compression:

Stored size: 854 Bytes

Contents

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

module Rack::Handler
  class Mock
    extend Test::Unit::Assertions

    def self.run(app, options={})
      assert_equal 9001, options[:Port]
      assert_equal 'foo.local', options[:Host]
      yield new
    end

    def stop
    end
  end
  
  register 'mock', 'Rack::Handler::Mock'
  Padrino::Server::Handlers << 'mock'
end

class ServerApp < Padrino::Application; end

class ServerTest < Test::Unit::TestCase
  def setup
    Padrino.mount_core("server_app")
  end

  context 'for server functionality' do
    should "locates the appropriate Rack handler and calls ::run" do
      Padrino.run!('foo.local', 9001, 'mock')
    end

    should "falls back on the next server handler when not found" do
      assert_raise(Padrino::Server::LoadError) { Padrino.run!('foo.local', 9001, 'foo') }
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
padrino-core-0.9.6 test/test_server.rb
padrino-core-0.9.5 test/test_server.rb
padrino-core-0.9.4 test/test_server.rb
padrino-core-0.9.3 test/test_server.rb
padrino-core-0.9.2 test/test_server.rb
padrino-core-0.9.1 test/test_server.rb
padrino-core-0.9.0 test/test_server.rb
padrino-core-0.8.5 test/test_server.rb
padrino-core-0.8.4 test/test_server.rb
padrino-core-0.8.3 test/test_server.rb
padrino-core-0.8.2 test/test_server.rb
padrino-core-0.8.1 test/test_server.rb
padrino-core-0.8.0 test/test_server.rb
padrino-core-0.7.9 test/test_server.rb
padrino-core-0.7.8 test/test_server.rb
padrino-core-0.7.7 test/test_server.rb
padrino-core-0.7.6 test/test_server.rb
padrino-core-0.7.5 test/test_server.rb
padrino-core-0.7.4 test/test_server.rb
padrino-core-0.7.3 test/test_server.rb