Sha256: 24431771cbe00966f2569cfe9c13d47fe090892ed6463586b3a133e17c83a550

Contents?: true

Size: 599 Bytes

Versions: 12

Compression:

Stored size: 599 Bytes

Contents

module Helpers
  module TempFileHelpers
    def clean_up_temp_files!
      FileUtils.remove_entry temp_root
    end

    def temp_root
      @temp_root ||= Dir.mktmpdir 'test_root'
    end

    def copy_root_to_temp(source)
      source = File.join(RSpec.project_root, source) unless Pathname.new(source).directory?
      FileUtils.copy_entry source, temp_root
    end

    def copy_file_to_temp(source, dest)
      dest_path = File.join(temp_root, dest)
      FileUtils.mkdir_p(File.dirname(dest_path))
      FileUtils.copy_entry(File.join(RSpec.project_root, source), dest_path)
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
cloudinary-1.13.0 spec/support/helpers/temp_file_helpers.rb
cloudinary-1.12.0 spec/support/helpers/temp_file_helpers.rb
cloudinary-1.11.1 spec/support/helpers/temp_file_helpers.rb
cloudinary-1.11.0 spec/support/helpers/temp_file_helpers.rb
cloudinary-1.10.1.pre.rc spec/support/helpers/temp_file_helpers.rb
cloudinary-1.10.0 spec/support/helpers/temp_file_helpers.rb
cloudinary-1.9.1 spec/support/helpers/temp_file_helpers.rb
cloudinary-1.9.0 spec/support/helpers/temp_file_helpers.rb
cloudinary-1.8.3 spec/support/helpers/temp_file_helpers.rb
cloudinary-1.8.2 spec/support/helpers/temp_file_helpers.rb
cloudinary-1.8.1 spec/support/helpers/temp_file_helpers.rb
cloudinary-1.8.0 spec/support/helpers/temp_file_helpers.rb