module XSpec::Evaluator::RSpecExpectations

### 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.

Public Class Methods

included(mod) click to toggle source
# File lib/xspec/evaluators.rb, line 303
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

Public Instance Methods

call(unit_of_work) click to toggle source
Calls superclass method
# File lib/xspec/evaluators.rb, line 314
def call(unit_of_work)
  super
rescue RSpec::Expectations::ExpectationNotMetError => e
  [Failure.new(unit_of_work, e.message, e.backtrace)]
end