Sha256: 6c08ba17392b384ce7fb37bd08643ca0f9cc0e63532e51d62c1b9bc4e851b8fb

Contents?: true

Size: 1012 Bytes

Versions: 5

Compression:

Stored size: 1012 Bytes

Contents

require "boty/rspec"

module Boty
  ::RSpec.describe Boty::RSpec::Bot do
    include described_class

    context "bot[Boty::Bot] instance" do
      it "includes a `bot` instance in the example scope" do
        expect(bot).to be_a Boty::DSL
      end
    end

    context "have_responded matcher" do
      it "provides a custom matcher to check against bot responses" do
        expect(self).to respond_to(:have_responded)
      end

      it "makes `Bot#say` work with the custom `have_responded` matcher" do
        bot.say "something"
        expect(bot).to have_responded "something"
      end

      it "clears up the `Bot#_response` after check by matcher" do
        bot.say "something"
        expect(bot).to have_responded "something"
      end
    end

    context "helpers" do
      it "includes #message_event to fire `data['type'] = 'message' events" do
        expect(@_bot).to receive(:event)
          .with "type" => "message", "text" => "omg"
        message "omg"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
boty-1.0.1 spec/boty/rspec_spec.rb
boty-1.0.0 spec/boty/rspec_spec.rb
boty-0.2.0 spec/boty/rspec_spec.rb
boty-0.1.2 spec/boty/rspec_spec.rb
boty-0.1.1 spec/boty/rspec_spec.rb