Sha256: e80893a80b8c6c70df74e7a6225d86f0d213377c2e507b82127e6693f1f13844

Contents?: true

Size: 723 Bytes

Versions: 1

Compression:

Stored size: 723 Bytes

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/fs/temp'

RSpec.describe ::EacRubyUtils::Fs::Temp do
  describe '#on_file' do
    it do
      temp_path = nil
      described_class.on_file do |path|
        temp_path = path
        expect(temp_path).not_to exist
        temp_path.write('StubText')
        expect(temp_path).to exist
      end
      expect(temp_path).not_to exist
    end

    it 'not fail if already removed' do
      temp_path = nil
      described_class.on_file do |path|
        temp_path = path
        expect(temp_path).not_to exist
        temp_path.write('StubText')
        expect(temp_path).to exist
        temp_path.unlink
      end
      expect(temp_path).not_to exist
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ehbrs-tools-0.6.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp.rb