Sha256: 33c088cdba58ae553e780316d167cc9c1419511b4a20e03ed4422b65da1eed1f

Contents?: true

Size: 842 Bytes

Versions: 5

Compression:

Stored size: 842 Bytes

Contents

require "spec_helper"

describe Lita::Response do
  subject { described_class.new(message, /dummy regexp/) }

  let(:message) { instance_double("Lita::Message").as_null_object }

  [:args, :reply, :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
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
lita-3.0.4 spec/lita/response_spec.rb
lita-3.0.3 spec/lita/response_spec.rb
lita-3.0.2 spec/lita/response_spec.rb
lita-3.0.1 spec/lita/response_spec.rb
lita-3.0.0 spec/lita/response_spec.rb