Class: Spec::RaiseErrorMatcher

Inherits:
Matcher show all
Defined in:
lib/opal/spec/matchers.rb

Instance Method Summary collapse

Methods inherited from Matcher

#failure, #initialize

Constructor Details

This class inherits a constructor from Spec::Matcher

Instance Method Details

#match(block) ⇒ Object



77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/opal/spec/matchers.rb', line 77

def match block
  should_raise = false
  begin
    block.call
    should_raise = true
  rescue => e
  end

  if should_raise
    failure "expected #{@actual} to be raised, but nothing was."
  end
end