Sha256: 2a4016608cd28eff159877bb89d95a23751df90c699e38945a2e61500a45c3bf

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

require 'spec_helper'

describe Cinch::Plugins::Seen do

  include Cinch::Test

  before(:each) do
    @bot = make_bot(Cinch::Plugins::Seen, { :filename => '/dev/null' })
  end

  it 'should allow users to see when users were last active' do
    get_replies(make_message(@bot, 'hello, world!', { :nick => 'foo', :channel => '#bar' }))
    sleep 1 # time-lord hack
    msg = make_message(@bot, '!seen foo', { :nick => 'baz', :channel => '#bar' })
    get_replies(msg).last.
      should match(/baz: I last saw foo \d seconds? ago/)
  end

  it 'should not respond to a users seen request for themselves' do
    msg = make_message(@bot, '!seen foo', { :nick => 'foo', :channel => '#bar' })
    get_replies(msg).
      should be_empty
  end

  it 'should inform users when a person has not been seen before' do
    msg = make_message(@bot, '!seen foo', { :channel => '#bar' })
    get_replies(msg).first.
      should == "test: I've never seen foo before, sorry!"
  end

  it 'should not let people make dumb jokes (or look for multiple people in one seen)' do
    get_replies(make_message(@bot, '!seen your mom today', { :channel => '#bar' })).
      should be_empty
    get_replies(make_message(@bot, '!seen archer pam lana', { :channel => '#bar' })).
      should be_empty
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cinch-seen-1.0.0 spec/cinch-seen_spec.rb