Sha256: 6d7d4b8f9ff4c10c7f31360309c40c041bc2b35bdd0e891a5336497f32fbb03f

Contents?: true

Size: 940 Bytes

Versions: 37

Compression:

Stored size: 940 Bytes

Contents

require 'volt/utils/generic_counting_pool'

class CountingPoolTest < GenericCountingPool
  def create(id, name=nil)
    return Object.new
  end
end

describe GenericCountingPool do
  before do
    @count_pool = CountingPoolTest.new
  end

  it "should lookup and retrieve" do
    item1 = @count_pool.find('one')

    item2 = @count_pool.find('one')
    item3 = @count_pool.find('two')

    expect(item1).to eq(item2)
    expect(item2).to_not eq(item3)
  end

  it "should only remove items when the same number have been removed as have been added" do
    item1 = @count_pool.find('_items', 'one')
    item2 = @count_pool.find('_items', 'one')
    expect(@count_pool.instance_variable_get('@pool')).to_not eq({})

    @count_pool.remove('_items', 'one')
    expect(@count_pool.instance_variable_get('@pool')).to_not eq({})

    @count_pool.remove('_items', 'one')
    expect(@count_pool.instance_variable_get('@pool')).to eq({})

  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
volt-0.8.14 spec/utils/generic_counting_pool_spec.rb
volt-0.8.13 spec/utils/generic_counting_pool_spec.rb
volt-0.8.11 spec/utils/generic_counting_pool_spec.rb
volt-0.8.10 spec/utils/generic_counting_pool_spec.rb
volt-0.8.9 spec/utils/generic_counting_pool_spec.rb
volt-0.8.8 spec/utils/generic_counting_pool_spec.rb
volt-0.8.7 spec/utils/generic_counting_pool_spec.rb
volt-0.8.6 spec/utils/generic_counting_pool_spec.rb
volt-0.8.5 spec/utils/generic_counting_pool_spec.rb
volt-0.8.4 spec/utils/generic_counting_pool_spec.rb
volt-0.8.3 spec/utils/generic_counting_pool_spec.rb
volt-0.8.2 spec/utils/generic_counting_pool_spec.rb
volt-0.8.1 spec/utils/generic_counting_pool_spec.rb
volt-0.8.0 spec/utils/generic_counting_pool_spec.rb
volt-0.7.23 spec/utils/generic_counting_pool_spec.rb
volt-0.7.22 spec/utils/generic_counting_pool_spec.rb
volt-0.7.21 spec/utils/generic_counting_pool_spec.rb
volt-0.7.20 spec/utils/generic_counting_pool_spec.rb
volt-0.7.19 spec/utils/generic_counting_pool_spec.rb
volt-0.7.18 spec/utils/generic_counting_pool_spec.rb