Module: Mollie::SMS::TestHelper::SMSExt

Defined in:
lib/mollie/sms/test_helper.rb

Overview

Extensions and overrides of the Mollie::SMS class for testing purposes.

The class method extensions are defined on the ClassMethods module.

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object


84
85
86
87
88
89
90
# File 'lib/mollie/sms/test_helper.rb', line 84

def self.included(klass)
  klass.class_eval do
    undef_method :deliver
    alias_method :deliver, :test_deliver
    extend ClassMethods
  end
end

Instance Method Details

#deliverResponse Also known as: test_deliver

Overrides the normal deliver method to never make an actual request.

Instead, the SMS message, that’s to be delivered, is added to the Mollie::SMS.deliveries list for later inspection.

The parameters are still validated.


105
106
107
108
109
# File 'lib/mollie/sms/test_helper.rb', line 105

def deliver
  validate_params!
  self.class.deliveries << self
  self.class.stubbed_response
end