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.116.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.116.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.115.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.114.2 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.114.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.114.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.113.6 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.113.5 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.113.4 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.113.3 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.113.2 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
ehbrs-tools-0.28.3 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.110.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.109.1 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.109.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
ehbrs-tools-0.28.2 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.108.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
ehbrs-tools-0.28.1 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
avm-tools-0.107.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
ehbrs-tools-0.28.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb