Sha256: 4be22071bec4404606e3bc375d399ea07c5c942a4380c9c57df6bcd5bd30c5e4

Contents?: true

Size: 580 Bytes

Versions: 3

Compression:

Stored size: 580 Bytes

Contents

require "spec_helper"
require "tmpdir"
require "daily_weekly_monthly/creator"

describe DailyWeeklyMonthly::Creator do
  let(:backup) { "some content" }
  let(:backups_dir) { Dir.mktmpdir }
  let(:ext) { "txt" }

  subject { described_class.new backup, backups_dir, ext }

  describe "#call" do
    it "writes a file using today's date into the correct backup directory" do
      subject.call "weekly"
      expect(File.read(File.join(backups_dir, "weekly", "#{Date.today.iso8601}.#{ext}"))).to eq backup
    end
  end

  after do
    FileUtils.remove_entry backups_dir
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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