Module: Classifile::AssertChecker
- Included in:
- State
- Defined in:
- lib/classifile/checker/assert_checker.rb
Overview
Wrapper class for Minitest::Assertions. Wrap and convert to Failed error when minitest’s Assert method is called.
Defined Under Namespace
Classes: Asserter
Instance Method Summary collapse
-
#method_missing(name, *args) ⇒ Object
Provides assert methods of minitest.
- #respond_to_missing?(sym) ⇒ Boolean
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
Provides assert methods of minitest.
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/classifile/checker/assert_checker.rb', line 25 def method_missing(name, *args) @assert = Asserter.new if @assert.nil? unless @assert.respond_to?(name) && name.to_s.include?("assert") raise NoMethodError.new("Method '#{name}' not found", name) end begin @assert.send name, *args rescue MiniTest::Assertion raise Failed unless @gotcha end end |