Sha256: 417dda1ef48e2853900c5f0a4d5b7981d5197dc9cc0bc590576f035f63f9b284

Contents?: true

Size: 906 Bytes

Versions: 6

Compression:

Stored size: 906 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

    possible_replies = [
      'I love cookies!',
      'I love pancakes!'
    ]
    expect(possible_replies).to include replies[0]
  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

6 entries across 6 versions & 1 rubygems

Version Path
lita-markov-1.1.2 spec/lita/handlers/markov_spec.rb
lita-markov-1.1.1 spec/lita/handlers/markov_spec.rb
lita-markov-1.1.0 spec/lita/handlers/markov_spec.rb
lita-markov-1.0.2 spec/lita/handlers/markov_spec.rb
lita-markov-1.0.1 spec/lita/handlers/markov_spec.rb
lita-markov-1.0.0 spec/lita/handlers/markov_spec.rb