Sha256: b4fc06d1a2a42f491815f252d6c672904d547d0d72c53e5f159271cb65a17281

Contents?: true

Size: 989 Bytes

Versions: 6

Compression:

Stored size: 989 Bytes

Contents

describe 'Services::Endpoint' do
  before(:each) do
    @ep_data = { 'name' => 'test', 'ip' => '127.0.0.1', 'proto' => 'http', 'port' => '80' }
    Services::Connection.new host: 'localhost'
    @ep = Services::Endpoint.new 'test', ip: '127.0.0.1', port: 80
  end

  it 'should raise without a service name' do
    expect { Services::Endpoint.new }.to raise_error
  end

  describe '#to_hash' do
    it 'should return each pair of insance vars' do
      @ep.to_hash.should eql @ep_data
    end
  end

  describe '#store' do
    it 'should store' do
      @ep.store
    end
  end

  describe '#load' do
    before do
      @ep = Services::Endpoint.new 'test'
    end

    it 'should handle no endpoint' do
      e = Services::Endpoint.new 'test_endpoint_fail'
      e.load
    end

    it 'should load' do
      @ep.load
      @ep.to_hash.should eql @ep_data
    end

    it 'should get ip' do
      @ep.ip.should eql ''
      @ep.load
      @ep.ip.should eql '127.0.0.1'
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
jn_services-1.0.8 spec/endpoint_spec.rb
jn_services-1.0.7 spec/endpoint_spec.rb
jn_services-1.0.6 spec/endpoint_spec.rb
jn_services-1.0.5 spec/endpoint_spec.rb
jn_services-1.0.4 spec/endpoint_spec.rb
jn_services-1.0.3 spec/endpoint_spec.rb