Sha256: 140880acba88e874e2fbbf1eea36370840371794378ada9e7002ded12722708b

Contents?: true

Size: 608 Bytes

Versions: 3

Compression:

Stored size: 608 Bytes

Contents

require 'spec_helper'
require 'hi/app'
require 'hi/server'

describe Hi::Server do
  let(:app)    { Hi::App.new }
  let(:server) { described_class.new(app) }

  describe '#start' do
    it 'starts up the app' do
      server.should_receive(:start!).with app.port

      server.start
    end

    it 'tries to start again on a different port requested port is in use' do
      server
        .should_receive(:start!)
        .exactly(Hi::Server::MAX_ATTEMPTS).times
        .and_raise RuntimeError

      expect {
        server.start
      }.to raise_error Hi::Server::CantStartServerError
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hi-1.2.2 spec/hi/server_spec.rb
hi-1.2.1 spec/hi/server_spec.rb
hi-1.2.0 spec/hi/server_spec.rb