Class: MultiTest::AssertionLibrary

Inherits:
Object
  • Object
show all
Defined in:
lib/multi_test/assertion_library.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(requirer, extender) ⇒ AssertionLibrary

Returns a new instance of AssertionLibrary.



9
10
11
12
# File 'lib/multi_test/assertion_library.rb', line 9

def initialize(requirer, extender)
  @requirer = requirer
  @extender = extender
end

Class Method Details

.detect_bestObject



5
6
7
# File 'lib/multi_test/assertion_library.rb', line 5

def self.detect_best
  available.detect(&:require?)
end

Instance Method Details

#extend_world(world) ⇒ Object



23
24
25
# File 'lib/multi_test/assertion_library.rb', line 23

def extend_world(world)
  @extender.call(world)
end

#require?Boolean

Returns:

  • (Boolean)


14
15
16
17
18
19
20
21
# File 'lib/multi_test/assertion_library.rb', line 14

def require?
  begin
    @requirer.call
    true
  rescue LoadError
    false
  end
end