Sha256: fd8e8a91a4f03ddd65e8402e2fe99864a282273244c50e8b6b10561725c1ba99

Contents?: true

Size: 950 Bytes

Versions: 1

Compression:

Stored size: 950 Bytes

Contents

require 'spec_helper'
require 'pry'

describe Lita::Handlers::Markov, lita_handler: true do
  before(:each) do
    subject.engine.db[:dictionary].delete
  end

  it "won't call #ingest for non-command messages" do
    expect(subject).to_not receive(:ingest)

    send_message "#{robot.name} foo"
    send_command 'bar'
  end

  it 'will build a sentence' do
    send_message 'I love cookies!'
    send_message 'I love pancakes!'

    send_command "#{robot.name} markov #{user.mention_name}"

    expect(replies.count).to eql 1

    reply = replies[0]
    possible_replies = [
      'I love cookies.',
      'I love pancakes.'
    ]
    expect(possible_replies.any? { |r| reply.include?(r) }).to eql true
  end

  it "will complain if the user hasn't said anything" do
    send_command "#{robot.name} markov #{user.mention_name}"

    expect(replies.count).to eql 1
    expect(replies[0]).to eql "Looks like Test User hasn't said anything!"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lita-markov-1.2.0 spec/lita/handlers/markov_spec.rb