/
help_spec.rb
41 lines (36 loc) · 842 Bytes
/
help_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
require "spec_helper"
describe Ruboty::Handlers::Help do
let(:robot) do
Ruboty::Robot.new
end
describe "#help" do
let(:from) do
"alice"
end
let(:to) do
"#general"
end
let(:body) do
<<-EOS.strip_heredoc.strip
ruboty /help( me)?\\z/i - Show this help message
ruboty /ping\\z/i - Return PONG to PING
ruboty /who am i\\?/i - Answer who you are
EOS
end
it "responds to `@ruboty help` and says each handler's usage" do
robot.should_receive(:say).with(
body: body,
code: true,
from: to,
to: from,
original: {
body: "@ruboty help",
from: from,
robot: robot,
to: to,
},
)
robot.receive(body: "@ruboty help", from: from, to: to)
end
end
end