spec/lita/message_spec.rb in lita-1.1.2 vs spec/lita/message_spec.rb in lita-2.0.0
- old
+ new
@@ -9,14 +9,10 @@
it "has a body" do
expect(subject.body).to eq("Hello")
end
- it "aliases #body with #message" do
- expect(subject.message).to eq("Hello")
- end
-
it "has a source" do
expect(subject.source).to eq("Carl")
end
describe "#args" do
@@ -46,24 +42,33 @@
"Carl"
)
expect(subject).to be_a_command
end
+ it "is true when the Robot's name is capitalized differently" do
+ subject = described_class.new(
+ robot,
+ "#{robot.mention_name.upcase}: hello",
+ "Carl"
+ )
+ expect(subject).to be_a_command
+ end
+
it "is false when the message is not addressed to the Robot" do
expect(subject).not_to be_a_command
end
end
- describe "#scan" do
- it "delegates to #body" do
- expect(subject.body).to receive(:scan)
- subject.scan
- end
- end
-
describe "#user" do
it "delegates to #source" do
expect(subject.source).to receive(:user)
subject.user
+ end
+ end
+
+ describe "#reply" do
+ it "sends strings back to the source through the robot" do
+ expect(robot).to receive(:send_messages).with("Carl", "foo", "bar")
+ subject.reply("foo", "bar")
end
end
end