Sha256: 83c1a8db7b2b8cc8440ea0a6729d5ac3a94daa08aaf2688539521672fdb6622f

Contents?: true

Size: 826 Bytes

Versions: 4

Compression:

Stored size: 826 Bytes

Contents

require "spec_helper"

require 'lita/handlers/enhance/node_index'

describe Lita::Handlers::Enhance::NodeIndex do
  include_context 'mocks'
  include_context 'redis'

  let(:index) { Lita::Handlers::Enhance::NodeIndex.new(redis, 'fqdn') }
  let(:node) { nodes.first }

  it 'should be able to add a node to the index' do
    index['127.0.0.1'] = node
  end

  it 'should be able to find a node in the index' do
    index['127.0.0.1'] = node
    new_node = index['127.0.0.1']
    expect(new_node.name).to eq(node.name)
  end

  it 'should return nil if no node is found in the index' do
    expect(index['127.0.0.5']).to be_nil
  end

  it 'should be able to return its size' do
    expect(index.size).to eq(0)
    nodes.each do |node|
      index[node.name] = node
    end
    expect(index.size).to eq(nodes.length)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lita-enhance-0.9.3 spec/lita/handlers/enhance/node_index_spec.rb
lita-enhance-0.9.2 spec/lita/handlers/enhance/node_index_spec.rb
lita-enhance-0.9.1 spec/lita/handlers/enhance/node_index_spec.rb
lita-enhance-0.9.0 spec/lita/handlers/enhance/node_index_spec.rb