Sha256: 408683411a4e7b538d1c93eadd3e4b4070626d1e282c561199c3fe4481819f1d

Contents?: true

Size: 925 Bytes

Versions: 1

Compression:

Stored size: 925 Bytes

Contents

module Imap::Backup
  describe Serializer::Directory do
    subject { described_class.new("path", "relative") }

    let(:windows) { false }

    before do
      allow(File).to receive(:directory?) { false }
      allow(Utils).to receive(:make_folder)
      allow(OS).to receive(:windows?) { windows }
      allow(Utils).to receive(:mode) { 0o600 }
      allow(FileUtils).to receive(:chmod)

      subject.ensure_exists
    end

    describe "#ensure_exists" do
      context "when the directory doesn't exist" do
        it "makes the directory" do
          expect(Utils).to have_received(:make_folder)
        end
      end

      it "sets permissions" do
        expect(FileUtils).to have_received(:chmod)
      end

      context "when on Windows" do
        let(:windows) { true }

        it "doesn't set permissions" do
          expect(FileUtils).to_not have_received(:chmod)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
imap-backup-6.0.0.rc2 spec/unit/imap/backup/serializer/directory_spec.rb