Sha256: ff6422a3684ee4d1660d5c4ccc00c7bc58f04b4d87c703475c9ab0e0e3510c4a

Contents?: true

Size: 1.69 KB

Versions: 20

Compression:

Stored size: 1.69 KB

Contents

require 'test_helper'

module Vedeu

  module Distributed

    describe Uri do

      let(:described) { Vedeu::Distributed::Uri }
      let(:instance)  { described.new(host, port) }
      let(:host)      {}
      let(:port)      {}

      describe '#initialize' do
        subject { instance }

        it { subject.must_be_instance_of(described) }
        it { subject.instance_variable_get('@host').must_equal('localhost') }
        it { subject.instance_variable_get('@port').must_equal(21_420) }
      end

      describe '#host' do
        subject { instance.host }

        context 'when the host has been defined by the client application' do
          let(:host) { 'myserver' }

          it 'returns the host' do
            subject.must_equal('myserver')
          end
        end

        context 'when the host has not been redefined' do
          it 'returns the default host' do
            subject.must_equal('localhost')
          end
        end
      end

      describe '#port' do
        subject { instance.port }

        context 'when the port has been defined by the client application' do
          let(:port) { 40_000 }

          it 'returns the port' do
            subject.must_equal(40_000)
          end
        end

        context 'when the port has not been redefined' do
          it 'returns the default port' do
            subject.must_equal(21_420)
          end
        end
      end

      describe '#to_s' do
        let(:host) { 'myserver' }
        let(:port) { 40_000 }

        subject { instance.to_s }

        it 'returns a single value for the uri' do
          subject.must_equal('druby://myserver:40000')
        end
      end

    end # Uri

  end # Distributed

end # Vedeu

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
vedeu-0.4.33 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.4.32 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.4.31 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.4.30 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.4.29 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.4.28 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.4.27 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.4.26 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.4.25 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.4.24 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.4.23 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.4.22 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.4.21 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.4.20 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.4.19 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.4.18 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.4.17 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.4.16 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.4.15 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.4.14 test/lib/vedeu/distributed/uri_test.rb