Sha256: 159d94f39ad8bccdc36518f0db95da7f793c1e106dff6fb90ce518bb38b59492

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

require "spec_helper"
require "surrender/yearly_policy"

describe Surrender::YearlyPolicy do
  context "when count = 2" do
    subject { Surrender::YearlyPolicy.new(2) }

    it "keeps the most recent filename of the last two years" do
      subject.add "a", Date.new(2011,  8, 9)
      subject.add "b", Date.new(2011,  9, 9)
      subject.add "c", Date.new(2011, 10, 9)

      subject.add "d", Date.new(2012,  8, 9)
      subject.add "e", Date.new(2012,  9, 9)
      subject.add "f", Date.new(2012, 10, 9)

      subject.add "g", Date.new(2013,  8, 9)
      subject.add "h", Date.new(2013,  9, 9)
      subject.add "i", Date.new(2013, 10, 9)

      subject.deleteable?("a").should == true
      subject.deleteable?("b").should == true
      subject.deleteable?("c").should == true

      subject.deleteable?("d").should == true
      subject.deleteable?("e").should == true
      subject.deleteable?("f").should == false

      subject.deleteable?("g").should == true
      subject.deleteable?("h").should == true
      subject.deleteable?("i").should == false
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
surrender-0.8.2 spec/yearly_policy_spec.rb
surrender-0.8.1 spec/yearly_policy_spec.rb
surrender-0.8.0 spec/yearly_policy_spec.rb