Class: MockMailer

Inherits:
Object
  • Object
show all
Defined in:
lib/mock_mailer.rb,
lib/mock_mailer/version.rb

Defined Under Namespace

Classes: Message

Constant Summary collapse

VERSION =
"0.0.1"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMockMailer

Returns a new instance of MockMailer.



7
8
9
10
# File 'lib/mock_mailer.rb', line 7

def initialize
  @messages = []
  @deliveries = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args) ⇒ Object



12
13
14
15
16
# File 'lib/mock_mailer.rb', line 12

def method_missing(*args)
  message_name = args.shift
  @messages << message_name
  Message.new(message_name, @deliveries)
end

Instance Attribute Details

#deliveriesObject (readonly)

Returns the value of attribute deliveries.



5
6
7
# File 'lib/mock_mailer.rb', line 5

def deliveries
  @deliveries
end

#messagesObject (readonly)

Returns the value of attribute messages.



5
6
7
# File 'lib/mock_mailer.rb', line 5

def messages
  @messages
end