spec/spec_helper.rb in chatterbot-0.3.0 vs spec/spec_helper.rb in chatterbot-0.4.0

- old
+ new

@@ -25,30 +25,32 @@ bot = Chatterbot::Bot.new bot.stub!(:load_config).and_return({}) bot end -def fake_search(max_id = 100, result_count = 0) +def fake_search(max_id = 100, result_count = 0, id_base=0) mock(TwitterOAuth::Client, { :search => { 'max_id' => max_id, - 'results' => 1.upto(result_count).collect { |i| fake_tweet(i) } + 'results' => 1.upto(result_count).collect { |i| fake_tweet(i, id_base) } } } ) end -def fake_replies(max_id = 100, result_count = 0) +def fake_replies(max_id = 100, result_count = 0, id_base = 0) mock(TwitterOAuth::Client, { - :replies => 1.upto(result_count).collect { |i| fake_tweet(i) } + :replies => 1.upto(result_count).collect { |i| fake_tweet(i, id_base) } } ) end -def fake_tweet(index) +def fake_tweet(index, id=0) + id = index if id <= 0 { :from_user => "chatterbot", - :index => index + :index => index, + :id => id } end