Sha256: 16a7271f383bf97c6dfec5b5d11b3894fd74c84e957969ec9d83a4a24a60423d

Contents?: true

Size: 946 Bytes

Versions: 56

Compression:

Stored size: 946 Bytes

Contents

require 'volt/utils/generic_counting_pool'

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

describe Volt::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

56 entries across 56 versions & 1 rubygems

Version Path
volt-0.9.7.pre8 spec/utils/generic_counting_pool_spec.rb
volt-0.9.7.pre7 spec/utils/generic_counting_pool_spec.rb
volt-0.9.7.pre6 spec/utils/generic_counting_pool_spec.rb
volt-0.9.7.pre5 spec/utils/generic_counting_pool_spec.rb
volt-0.9.7.pre3 spec/utils/generic_counting_pool_spec.rb
volt-0.9.7.pre2 spec/utils/generic_counting_pool_spec.rb
volt-0.9.6 spec/utils/generic_counting_pool_spec.rb
volt-0.9.6.pre3 spec/utils/generic_counting_pool_spec.rb
volt-0.9.6.pre2 spec/utils/generic_counting_pool_spec.rb
volt-0.9.6.pre1 spec/utils/generic_counting_pool_spec.rb
volt-0.9.5 spec/utils/generic_counting_pool_spec.rb
volt-0.9.5.pre12 spec/utils/generic_counting_pool_spec.rb
volt-0.9.5.pre11 spec/utils/generic_counting_pool_spec.rb
volt-0.9.5.pre9 spec/utils/generic_counting_pool_spec.rb
volt-0.9.5.pre8 spec/utils/generic_counting_pool_spec.rb
volt-0.9.5.pre7 spec/utils/generic_counting_pool_spec.rb
volt-0.9.5.pre6 spec/utils/generic_counting_pool_spec.rb
volt-0.9.5.pre5 spec/utils/generic_counting_pool_spec.rb
volt-0.9.5.pre4 spec/utils/generic_counting_pool_spec.rb
volt-0.9.5.pre3 spec/utils/generic_counting_pool_spec.rb