Module: Sequent::Core::Helpers::MessageMatchers::DSL

Included in:
Sequent::Core::Helpers::MessageMatchers
Defined in:
lib/sequent/core/helpers/message_matchers/dsl.rb

Instance Method Summary collapse

Instance Method Details

#register_matcher(name, matcher_class) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/sequent/core/helpers/message_matchers/dsl.rb', line 8

def register_matcher(name, matcher_class)
  if respond_to?(name)
    fail ArgumentError, "Cannot register message matcher because it would overwrite existing method '#{name}'"
  end

  define_method(name) do |*expected|
    matcher_class.new(*expected)
  end
end