Sha256: a55358b2131ef00422bc442d96a2c6bc057f835a1e4c3776944aa95305f7ffa9

Contents?: true

Size: 1.3 KB

Versions: 2

Compression:

Stored size: 1.3 KB

Contents

require 'rubygems'
require 'minitest/unit'
require 'flexmock/test_unit_integration'
require 'minitest/autorun'
require 'rake'
require File.expand_path('../file_creation', __FILE__)
require File.expand_path('../in_environment', __FILE__)

class Rake::TestCase < MiniTest::Unit::TestCase
  include FlexMock::ArgumentTypes
  include FlexMock::MockContainer

  include InEnvironment
  include FileCreation

  include Rake::DSL

  class TaskManager
    include Rake::TaskManager
  end

  def setup
    @orig_PWD = Dir.pwd
  end

  def teardown
    flexmock_teardown

    Dir.chdir @orig_PWD
  end

  def ignore_deprecations
    Rake.application.options.ignore_deprecate = true
    yield
  ensure
    Rake.application.options.ignore_deprecate = false
  end

end

# workarounds for 1.8
$" << 'test/helper.rb'
Test::Unit.run = true if Test::Unit.respond_to? :run=

class ThreadSafeArray
  def initialize
    @mutex = Mutex.new
    @array = Array.new
  end

  Array.public_instance_methods.each do |method_name|
    unless method_name =~ %r!\A__! or method_name =~ %r!\A(object_)?id\Z!
      # TODO: jettison 1.8.6; use define_method with |&block|
      eval %{
        def #{method_name}(*args, &block)
          @mutex.synchronize {
            @array.send('#{method_name}', *args, &block)
          }
        end
      }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
drake-0.9.2.0.3.1 test/helper.rb
drake-0.9.1.0.3.0 test/helper.rb