Sha256: 861a2a718f089af93bb78ff966ed5491eb04919d1c1868958319c8a1deca682e

Contents?: true

Size: 1 KB

Versions: 3

Compression:

Stored size: 1 KB

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
      puts "storing #{@ep.inspect}"
      @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

3 entries across 3 versions & 1 rubygems

Version Path
jn_services-1.0.2 spec/endpoint_spec.rb
jn_services-1.0.1 spec/endpoint_spec.rb
jn_services-1.0.0 spec/endpoint_spec.rb