Sha256: 6321520ce388220edb1342cdd5003d58914edf7b4eb01e25086677fdc42afa67
Contents?: true
Size: 1.54 KB
Versions: 1
Compression:
Stored size: 1.54 KB
Contents
require 'multi_test/minitest_world' module MultiTest class AssertionLibrary def self.detect_best available.detect(&:require?) end def initialize(requirer, extender) @requirer = requirer @extender = extender end def require? begin @requirer.call true rescue LoadError false end end def extend_world(world) @extender.call(world) end private def self.available @available ||= [ AssertionLibrary.new( proc { require 'rspec/expectations' }, proc { |object| object.extend(::RSpec::Matchers) }, ), AssertionLibrary.new( proc { require 'spec/expectations' require 'spec/runner/differs/default' require 'ostruct' }, proc { |object| options = OpenStruct.new(:diff_format => :unified, :context_lines => 3) Spec::Expectations.differ = Spec::Expectations::Differs::Default.new(options) object.extend(Spec::Matchers) }, ), AssertionLibrary.new( proc { require 'minitest/assertions' }, proc { |object| object.extend(MinitestWorld) }, ), AssertionLibrary.new( proc { require 'minitest/unit' }, proc { |object| object.extend(MiniTest::Assertions) }, ), AssertionLibrary.new( proc { require 'test/unit/assertions' }, proc { |object| object.extend(Test::Unit::Assertions) }, ), ] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
multi_test-0.1.0 | lib/multi_test/assertion_library.rb |