Sha256: fcd6ecffca31f4ae5f370ec275d2baa89cc795f98296e54fb1ec517a25fee5f7

Contents?: true

Size: 1.48 KB

Versions: 118

Compression:

Stored size: 1.48 KB

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/fs/temp'

RSpec.describe ::EacRubyUtils::Fs::Temp do
  describe '#on_file' do
    it do # rubocop:disable RSpec/ExampleLength, RSpec/MultipleExpectations
      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 # rubocop:disable RSpec/ExampleLength, RSpec/MultipleExpectations
      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 # rubocop:disable RSpec/ExampleLength, RSpec/MultipleExpectations
      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 # rubocop:disable RSpec/ExampleLength, RSpec/MultipleExpectations
      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

118 entries across 118 versions & 2 rubygems

Version Path
eac_tools-0.76.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
eac_tools-0.76.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
eac_tools-0.75.2 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
eac_tools-0.75.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
eac_tools-0.75.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
eac_tools-0.74.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
eac_tools-0.74.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
eac_tools-0.73.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
eac_tools-0.72.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
eac_tools-0.70.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
eac_tools-0.70.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
eac_tools-0.69.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
eac_tools-0.69.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
eac_tools-0.68.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
eac_tools-0.67.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
eac_tools-0.67.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
eac_tools-0.66.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
eac_tools-0.65.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
eac_tools-0.65.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb
eac_tools-0.64.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb