Sha256: 6f542e53eb5c4adc214c10927a62b60abb787cee9a1e1cdc03e138658a5f0f44

Contents?: true

Size: 674 Bytes

Versions: 2

Compression:

Stored size: 674 Bytes

Contents

require File.join(File.dirname(__FILE__), "/../spec_helper")

describe SimpleArrayEviction do
  it "should evict the first records in an array, keeping the default 10 records" do
    a = (1..15).to_a
    
    def a.nontainting_shift
      shift
    end
    
    s = SimpleArrayEviction.new
    s.update(a)
    a.size.should eql(10)
    a.first.should eql(6)
    a.last.should eql(15)
  end
  
  it "should be able to take a different eviction threshold" do
    a = (1..15).to_a
    
    def a.nontainting_shift
      shift
    end
    
    s = SimpleArrayEviction.new(2)
    s.update(a)
    a.size.should eql(2)
    a.first.should eql(14)
    a.last.should eql(15)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
davidrichards-repositories-0.0.3 spec/repositories/simple_array_eviction_spec.rb
davidrichards-repositories-0.0.4 spec/repositories/simple_array_eviction_spec.rb