Module: Jarvis::TestSupport

Defined in:
lib/jarvis/test_support/test_support.rb

Instance Method Summary collapse

Instance Method Details

#parsed_response(response) ⇒ Object



18
19
20
# File 'lib/jarvis/test_support/test_support.rb', line 18

def parsed_response(response)
  JSON.parse(response.body)["text"]
end

#slack_outgoing_message(options = {text:"Jarvis, what's going on?"}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/jarvis/test_support/test_support.rb', line 5

def slack_outgoing_message(options={text:"Jarvis, what's going on?"})
  {
    "team_id" => options[:team_id] || "T0001",
    "channel_id" => options[:channel_id] || "BLAH",
    "channel_name" => options[:channel_name] || "test",
    "timestamp" => options[:timestamp] || "1355517523.000005",
    "user_id" => options[:user_id] || "U2147483697",
    "user_name" => options[:user_name] || "Steve",
    "text" => options[:text],
    "trigger_word" => options[:trigger_word] || "Jarvis"
  }
end

#stub_env(hash) ⇒ Object



22
23
24
# File 'lib/jarvis/test_support/test_support.rb', line 22

def stub_env(hash)
  stub_const('ENV', ENV.to_hash.merge(hash))
end