Sha256: 08ca520dedd62b0c698fd08bb4e4f4220c8e3a5b3f6d7844dae9c09454af8c64

Contents?: true

Size: 984 Bytes

Versions: 3

Compression:

Stored size: 984 Bytes

Contents

require "spec_helper"
require "surrender/monthly_policy"

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

    it "keeps the latest backup of the last three months" do
      subject.add "a", Date.new(2013, 3, 1)
      subject.add "b", Date.new(2013, 3, 15)

      subject.add "c", Date.new(2013, 4, 1)
      subject.add "d", Date.new(2013, 4, 15)

      subject.add "e", Date.new(2013, 5, 1)
      subject.add "f", Date.new(2013, 5, 15)

      subject.add "g", Date.new(2013, 6, 1)
      subject.add "h", Date.new(2013, 6, 15)

      subject.deleteable?("a").should == true
      subject.deleteable?("b").should == true
      subject.deleteable?("c").should == true
      subject.deleteable?("d").should == false
      subject.deleteable?("e").should == true
      subject.deleteable?("f").should == false
      subject.deleteable?("g").should == true
      subject.deleteable?("h").should == false
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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