Sha256: 8f7ab1de1cfc4f0e845f1adcc135e656e6198f7f596227219642efdf396d2c2b

Contents?: true

Size: 1.22 KB

Versions: 132

Compression:

Stored size: 1.22 KB

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

  describe '#on_directory' do
    it do
      temp_path = nil
      described_class.on_directory do |path|
        temp_path = path
        expect(temp_path).to be_directory
      end
      expect(temp_path).not_to exist
    end

    it 'not fail if already removed' do
      temp_path = nil
      described_class.on_directory do |path|
        temp_path = path
        expect(temp_path).to be_directory
        temp_path.rmtree
        expect(temp_path).not_to exist
      end
      expect(temp_path).not_to exist
    end
  end
end

Version data entries

132 entries across 132 versions & 2 rubygems

Version Path
avm-tools-0.67.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.66.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.65.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.64.2 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.64.1 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.64.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.63.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.62.4 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.62.3 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.62.2 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.62.1 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.62.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.61.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.60.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.59.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.58.1 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.58.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.57.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
ehbrs-tools-0.13.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.56.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb