Sha256: de36750cbe3e506965723700ea20b91650f9780f592782a0cef65d119dc3cc2a
Contents?: true
Size: 1.52 KB
Versions: 4
Compression:
Stored size: 1.52 KB
Contents
# frozen_string_literal: true require "spec_helper" describe Lita::Response do subject { described_class.new(message, instance_double("Regexp")) } let(:message) { instance_double("Lita::Message").as_null_object } %i[args reply reply_privately reply_with_mention user command?].each do |method| it "delegates :#{method} to #message" do expect(message).to receive(method) subject.public_send(method) end end describe "#matches" do it "matches the pattern against the message" do expect(message).to receive(:match).with(subject.pattern) subject.matches end end describe "#match_data" do let(:body) { instance_double("String") } it "matches the message body against the pattern" do allow(message).to receive(:body).and_return(body) expect(subject.pattern).to receive(:match).with(message.body) subject.match_data end end describe "#extensions" do it "can be populated with arbitrary data" do subject.extensions[:foo] = :bar expect(subject.extensions[:foo]).to eq(:bar) end end describe "#user" do it "delegates to #message" do expect(subject.message).to receive(:user) subject.user end end describe "#room" do it "delegates to #message" do expect(subject.message).to receive(:room_object) subject.room end end describe "#private_message?" do it "delegates to #message" do expect(subject.message).to receive(:private_message?) subject.private_message? end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
rita-5.0.0.alpha.4 | spec/lita/response_spec.rb |
rita-5.0.0.alpha.3 | spec/lita/response_spec.rb |
rita-5.0.0.alpha.2 | spec/lita/response_spec.rb |
rita-5.0.0.alpha.1 | spec/lita/response_spec.rb |