Module: Superbolt::SpecHelpers

Defined in:
lib/superbolt/spec_helpers.rb

Instance Method Summary collapse

Instance Method Details

#last_superbolt_messageObject



13
14
15
# File 'lib/superbolt/spec_helpers.rb', line 13

def last_superbolt_message
  superbolt_messages.last
end

#messenger_classObject



25
26
27
# File 'lib/superbolt/spec_helpers.rb', line 25

def messenger_class
  Superbolt::Messenger
end

#stub_superbolt_messengerObject



21
22
23
# File 'lib/superbolt/spec_helpers.rb', line 21

def stub_superbolt_messenger
  allow(Superbolt).to receive(:message) { |args| superbolt_message }
end

#superbolt_messageObject



3
4
5
6
7
8
9
10
11
# File 'lib/superbolt/spec_helpers.rb', line 3

def superbolt_message
  superbolt_message = messenger_class.new
  allow(superbolt_message).to receive(:send!) do |args|
    superbolt_message.data(args)
    superbolt_messages << superbolt_message
  end

  superbolt_message
end

#superbolt_messagesObject



17
18
19
# File 'lib/superbolt/spec_helpers.rb', line 17

def superbolt_messages
  @superbolt_messages ||= []
end