Class: Surrogate::RSpec::WithFilter::BlockAsserter::RaiseAsserter
- Inherits:
-
Object
- Object
- Surrogate::RSpec::WithFilter::BlockAsserter::RaiseAsserter
- Defined in:
- lib/surrogate/rspec/block_asserter.rb
Instance Method Summary collapse
- #call(exception) ⇒ Object
-
#initialize(arg, message) ⇒ RaiseAsserter
constructor
A new instance of RaiseAsserter.
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, ) @assertion = if arg.kind_of? String arg elsif arg.kind_of? Regexp match_regexp arg elsif arg, arg, else raise ArgumentError, "raising(#{arg.inspect}, #{.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 |