Sha256: ca5c760ac7b328ea994682ee232bf33a892d2ac80f0bbb3623073a571acf9adb

Contents?: true

Size: 970 Bytes

Versions: 3

Compression:

Stored size: 970 Bytes

Contents

# -*- coding: utf-8 -*-
require 'spec_helper'

describe Cinch::Plugins::UrbanDict do
  include Cinch::Test

  before(:all) do
    @bot = make_bot(Cinch::Plugins::UrbanDict)
  end

  it 'should allow users to search for words' do
    get_replies(make_message(@bot, '!ud dork')).first.text.
      should match('Someone who has odd interests')
  end

  it 'should not return nil for valid searches' do
    get_replies(make_message(@bot, '!ud dork')).first.text.
      should_not be_nil
  end

  it 'should return an error for invalid searches' do
    get_replies(make_message(@bot, '!ud 7zJ6t8rT8p384My')).first.text.
      should == "test: Urban Dictionary ∴ 7zJ6t8rT8p384My: No definition available."
  end

  it 'should not return multiple lines for a definition with breaks' do
    response = get_replies(make_message(@bot, '!ud dong')).first.text
    response.should_not match("<br")
    response.should_not match("\r")
    response.should_not match("\n")
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cinch-urbandict-1.0.3 spec/cinch-urbandict_spec.rb
cinch-urbandict-1.0.2 spec/cinch-urbandict_spec.rb
cinch-urbandict-1.0.1 spec/cinch-urbandict_spec.rb