Sha256: 24ccccd28979d39bc81b1d81c974025dab8f6fe86b8c34c7e648f6e01583918f

Contents?: true

Size: 870 Bytes

Versions: 2

Compression:

Stored size: 870 Bytes

Contents

require File.expand_path(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

2 entries across 2 versions & 1 rubygems

Version Path
padrino-core-0.9.10 test/test_server.rb
padrino-core-0.9.9 test/test_server.rb