Sha256: 65d1fc492d791ac24e39f7c557838c03f7254d4312a05b493914e9040443aa65

Contents?: true

Size: 976 Bytes

Versions: 3

Compression:

Stored size: 976 Bytes

Contents

require "spec_helper"
require "daily_weekly_monthly/processor"

describe DailyWeeklyMonthly::Processor do
  let(:backup) { double :backup }
  let(:dir) { double :dir }
  let(:ext) { double :ext }
  let(:creator) { double :creator, call: true }
  let(:cleaner) { double :cleaner, call: true }

  subject { described_class.new backup, dir, ext }

  before do
    allow(DailyWeeklyMonthly::Creator).to receive(:new).with(backup, dir, ext) { creator }
    allow(DailyWeeklyMonthly::Cleaner).to receive(:new).with(dir, ext) { cleaner }
  end

  describe "#call" do
    let(:period) { "weekly" }
    let(:options) { {keep: to_keep} }
    let(:to_keep) { 5 }

    it "calls the creator with the period" do
      expect(creator).to receive(:call).with(period)
      subject.call period, options
    end

    it "calls the cleaner with the period and number to keep" do
      expect(cleaner).to receive(:call).with(period, to_keep)
      subject.call period, options
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
daily_weekly_monthly-0.0.4 spec/daily_weekly_monthly/processor_spec.rb
daily_weekly_monthly-0.0.3 spec/daily_weekly_monthly/processor_spec.rb
daily_weekly_monthly-0.0.2 spec/daily_weekly_monthly/processor_spec.rb