Sha256: 7618e61af8482b61df159b054a0ff76f4e36b9e748b385da1a8cf804dfa1bf2f

Contents?: true

Size: 1.1 KB

Versions: 5

Compression:

Stored size: 1.1 KB

Contents

require "bundler/setup"
require "torba"
require "torba/remote_sources/common"

require "minitest/autorun"
require "tmpdir"
require "fileutils"

module Torba
  module Test
    module TempHome
      def before_setup
        Torba.home_path = @_torba_tmp_dir = File.realpath(Dir.mktmpdir("torba"))
        super
      end

      def after_teardown
        FileUtils.rm_rf(@_torba_tmp_dir)
        Torba.home_path = nil
        super
      end
    end

    module AssertExists
      def assert_exists(file_path)
        assert File.exists?(file_path)
      end

      def refute_exists(file_path)
        refute File.exists?(file_path)
      end
    end

    module Touch
      def touch(path)
        FileUtils.mkdir_p(File.dirname(path))
        FileUtils.touch(path)
      end
    end

    class RemoteSource
      include RemoteSources::Common

      attr_reader :cache_path

      def initialize(cache_path)
        @cache_path = cache_path
      end

      def ensure_cached; end
    end
  end
end

class Minitest::Test
  include Torba::Test::TempHome
  include Torba::Test::AssertExists
  include Torba::Test::Touch
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
torba-0.4.0 test/test_helper.rb
torba-0.3.1 test/test_helper.rb
torba-0.3.0 test/test_helper.rb
torba-0.2.1 test/test_helper.rb
torba-0.2.0 test/test_helper.rb