Sha256: 4d0ba5d526896465bc78bdf58da5e63998d017f8ea535400937b3e1d55421b97
Contents?: true
Size: 1.51 KB
Versions: 2
Compression:
Stored size: 1.51 KB
Contents
describe Lita::Adapters::Shell do let(:robot) { double("Lita::Robot", name: "Lita", mention_name: "LitaBot") } subject { described_class.new(robot) } describe "#run" do before do allow(subject).to receive(:puts) allow(subject).to receive(:print) allow($stdin).to receive(:gets).and_return("foo", "exit") allow(robot).to receive(:trigger) allow(robot).to receive(:receive) end it "passes input to the Robot and breaks on an exit message" do expect(subject).to receive(:print).with("#{robot.name} > ").twice expect(robot).to receive(:receive).with(an_instance_of(Lita::Message)) subject.run end it "marks messages as commands if config.adapter.private_chat is true" do Lita.config.adapter.private_chat = true expect_any_instance_of(Lita::Message).to receive(:command!) subject.run end it "triggers a connected event" do expect(robot).to receive(:trigger).with(:connected) subject.run end end describe "#send_message" do it "prints its input" do expect(subject).to receive(:puts) do |messages| expect(messages.first).to include("bar") end subject.send_messages(double("target"), "bar") end it "doesn't output empty messages" do expect(subject).to receive(:puts).with([]) subject.send_messages(double("target"), "") end end describe "#shut_down" do it "outputs a blank line" do expect(subject).to receive(:puts) subject.shut_down end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
lita-2.6.0 | spec/lita/adapters/shell_spec.rb |
lita-2.5.0 | spec/lita/adapters/shell_spec.rb |