Sha256: 966c22279d6be318797a7cac2b3c0c4a100f3bcef4d83d408be30c86e1595eee

Contents?: true

Size: 1.45 KB

Versions: 3

Compression:

Stored size: 1.45 KB

Contents

# simplecov must be loaded FIRST. Only the files required after it gets loaded
# will be profiled !!!
if ENV['TEST_ENABLE_COVERAGE'] == '1'
    begin
        require 'simplecov'
        SimpleCov.start
    rescue LoadError
        require 'snapsync'
        Snapsync.warn "coverage is disabled because the 'simplecov' gem cannot be loaded"
    rescue Exception => e
        require 'snapsync'
        Snapsync.warn "coverage is disabled: #{e.message}"
    end
end

require 'minitest/autorun'
require 'snapsync'
require 'flexmock/minitest'
require 'minitest/spec'

if ENV['TEST_ENABLE_PRY'] != '0'
    begin
        require 'pry'
    rescue Exception
        Snapsync.warn "debugging is disabled because the 'pry' gem cannot be loaded"
    end
end

module Snapsync
    # This module is the common setup for all tests
    #
    # It should be included in the toplevel describe blocks
    #
    # @example
    #   require 'snapsync/test'
    #   describe Snapsync do
    #     include Snapsync::SelfTest
    #   end
    #
    module SelfTest
        def setup
            @tempdirs = Array.new
            super
            # Setup code for all the tests
        end

        def teardown
            @tempdirs.each do |dir|
                FileUtils.rm_rf dir
            end
            super
            # Teardown code for all the tests
        end

        def make_tmpdir
            @tempdirs << Dir.mktmpdir
        end
    end
end

Minitest::Test.include Snapsync::SelfTest

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
snapsync-0.3.8 lib/snapsync/test.rb
snapsync-0.3.7 lib/snapsync/test.rb
snapsync-0.3.6 lib/snapsync/test.rb