Module: XSpec::Evaluator::RSpecExpectations
- Defined in:
- lib/xspec/evaluators.rb
Overview
### RSpec Integration
This RSpec adapter shows two useful techniques: dynamic library loading which removes RSpec as a direct dependency, and use of the ‘mixin` method to further extend the target evalutor.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(mod) ⇒ Object
311 312 313 314 315 316 317 318 319 320 |
# File 'lib/xspec/evaluators.rb', line 311 def self.included(mod) begin require 'rspec/expectations' require 'rspec/matchers' rescue LoadError raise "RSpec is not available, cannot use RSpec assertion context." end mod.include(RSpec::Matchers) end |
Instance Method Details
#call(unit_of_work) ⇒ Object
322 323 324 325 326 |
# File 'lib/xspec/evaluators.rb', line 322 def call(unit_of_work) super rescue RSpec::Expectations::ExpectationNotMetError => e [Failure.new(unit_of_work, e., e.backtrace)] end |