class Sequent::Core::Helpers::MessageMatchers::ArgumentCoercer
Public Class Methods
coerce_argument(arg)
click to toggle source
# File lib/sequent/core/helpers/message_matchers/argument_coercer.rb, line 9 def coerce_argument(arg) fail ArgumentError, 'Cannot coerce nil argument' if arg.nil? return MessageMatchers::InstanceOf.new(arg) if [Class, Module].include?(arg.class) return arg if arg.respond_to?(:matches_message?) fail ArgumentError, "Can't coerce argument '#{arg}'; " \ 'must be either a Class, Module or message matcher (respond to :matches_message?)' end