Sha256: 402f34aa3cd3fd5df7edd7689c43e460ce436952cc649340c10e883819a86868

Contents?: true

Size: 1.68 KB

Versions: 16

Compression:

Stored size: 1.68 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(21420) }
      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) { 40000 }

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

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

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

        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

16 entries across 16 versions & 1 rubygems

Version Path
vedeu-0.4.13 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.4.12 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.4.11 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.4.10 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.4.9 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.4.8 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.4.7 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.4.6 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.4.5 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.4.4 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.4.3 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.4.2 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.4.1 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.4.0 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.3.5 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.3.4 test/lib/vedeu/distributed/uri_test.rb