Sha256: ff42a854c4b9cef1a7779ff737495d453cace0cd470283ef4a6f31edcc09948b

Contents?: true

Size: 1.71 KB

Versions: 114

Compression:

Stored size: 1.71 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
        it { instance.must_be_instance_of(described) }
        it { instance.instance_variable_get('@host').must_equal('localhost') }
        it { instance.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 { instance.must_respond_to(:to_str) }

        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

114 entries across 114 versions & 1 rubygems

Version Path
vedeu-0.7.4 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.7.3 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.7.2 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.7.1 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.7.0 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.6.71 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.6.70 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.6.69 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.6.68 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.6.67 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.6.66 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.6.65 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.6.64 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.6.63 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.6.62 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.6.61 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.6.60 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.6.59 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.6.58 test/lib/vedeu/distributed/uri_test.rb
vedeu-0.6.57 test/lib/vedeu/distributed/uri_test.rb