Class: Surrogate::RSpec::WithFilter::BlockAsserter::RaiseAsserter

Inherits:
Object
  • Object
show all
Defined in:
lib/surrogate/rspec/block_asserter.rb

Instance Method Summary collapse

Constructor Details

#initialize(arg, message) ⇒ RaiseAsserter

Returns a new instance of RaiseAsserter.



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/surrogate/rspec/block_asserter.rb', line 6

def initialize(arg, message)
  @assertion = if arg.kind_of? String
                 match_message arg
               elsif arg.kind_of? Regexp
                 match_regexp arg
               elsif exception_and_message? arg, message
                 match_exception_and_message arg, message
               else
                 raise ArgumentError, "raising(#{arg.inspect}, #{message.inspect}) are not valid arguments"
               end
end

Instance Method Details

#call(exception) ⇒ Object



18
19
20
# File 'lib/surrogate/rspec/block_asserter.rb', line 18

def call(exception)
  @assertion.call exception
end