Sha256: b685b02013383c53eebb13bfa123afbad43024a15add13f7d249b7e3d9d5fa4a

Contents?: true

Size: 1.03 KB

Versions: 9

Compression:

Stored size: 1.03 KB

Contents

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))

require 'bundler/setup'
Bundler.require

require 'rspec'
require 'chatterbot'

require "twitter_oauth"


require 'tempfile'
require 'sqlite3'


# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}


def test_bot
  bot = Chatterbot::Bot.new
  bot.stub!(:load_config).and_return({})
  bot
end

def fake_search(max_id = 100, result_count = 0)
  mock(TwitterOAuth::Client,
       {
         :search => {
           'max_id' => max_id,
           'results' => 1.upto(result_count).collect { |i| fake_tweet(i) }
         }        
       }
       )
end

def fake_replies(max_id = 100, result_count = 0)
  mock(TwitterOAuth::Client,
       {
         :replies => 1.upto(result_count).collect { |i| fake_tweet(i) }
       }
       )
end

def fake_tweet(index)
  {
    :from_user => "chatterbot",
    :index => index
  }
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
chatterbot-0.2.8 spec/spec_helper.rb
chatterbot-0.2.7 spec/spec_helper.rb
chatterbot-0.2.6 spec/spec_helper.rb
chatterbot-0.2.5 spec/spec_helper.rb
chatterbot-0.2.4 spec/spec_helper.rb
chatterbot-0.2.3 spec/spec_helper.rb
chatterbot-0.2.2 spec/spec_helper.rb
chatterbot-0.2.1 spec/spec_helper.rb
chatterbot-0.2.0 spec/spec_helper.rb