Module: Twi::Mocking

Included in:
Twi
Defined in:
lib/twi/mocking.rb

Instance Method Summary collapse

Instance Method Details

#conversationObject



15
16
17
# File 'lib/twi/mocking.rb', line 15

def conversation(...)
  (@mock ? Mock::Conversation : Conversation).new(...)
end

#create_messageObject



11
12
13
# File 'lib/twi/mocking.rb', line 11

def create_message(...)
  message(...).tap &:create
end

#create_phoneObject



7
8
9
# File 'lib/twi/mocking.rb', line 7

def create_phone(...)
  phone(...).tap &:create
end

#eventObject



19
20
21
# File 'lib/twi/mocking.rb', line 19

def event(...)
  (@mock ? Mock::Event : Event).new(...)
end

#messageObject



27
28
29
# File 'lib/twi/mocking.rb', line 27

def message(...)
  (@mock ? Mock::Message : Message).new(...)
end

#mockObject



3
4
5
# File 'lib/twi/mocking.rb', line 3

def mock
  @mock ||= Twi::Mock.new
end

#phoneObject



23
24
25
# File 'lib/twi/mocking.rb', line 23

def phone(...)
  (@mock ? Mock::Phone : Phone).new(...)
end