spec/search_spec.rb in chatterbot-0.9.1 vs spec/search_spec.rb in chatterbot-0.9.2

- old
+ new

@@ -1,26 +1,8 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe "Chatterbot::Search" do - describe "exclude_retweets" do - before(:each) do - @bot = Chatterbot::Bot.new - end - - it "should tack onto query" do - expect(@bot.exclude_retweets("foo")).to eq("foo -include:retweets") - end - - it "shouldn't tack onto query" do - expect(@bot.exclude_retweets("foo -include:retweets")).to eq("foo -include:retweets") - end - - it "shouldn't tack onto query" do - expect(@bot.exclude_retweets("foo include:retweets")).to eq("foo include:retweets") - end - end - it "calls search" do bot = Chatterbot::Bot.new expect(bot).to receive(:search) bot.search("foo") end @@ -38,40 +20,40 @@ it "accepts multiple searches at once" do bot = test_bot allow(bot).to receive(:client).and_return(fake_search(100, 1)) - expect(bot.client).to receive(:search).once.ordered.with("foo -include:retweets", {:result_type=>"recent"}) - expect(bot.client).to receive(:search).once.ordered.with("bar -include:retweets", {:result_type=>"recent"}) + expect(bot.client).to receive(:search).once.ordered.with("foo", {:result_type=>"recent"}) + expect(bot.client).to receive(:search).once.ordered.with("bar", {:result_type=>"recent"}) bot.search(["foo", "bar"]) end it "accepts extra params" do bot = test_bot allow(bot).to receive(:client).and_return(fake_search(100, 1)) - expect(bot.client).to receive(:search).with("foo -include:retweets", {:lang => "en", :result_type=>"recent"}) + expect(bot.client).to receive(:search).with("foo", {:lang => "en", :result_type=>"recent"}) bot.search("foo", :lang => "en") end it "accepts a single search query" do bot = test_bot allow(bot).to receive(:client).and_return(fake_search(100, 1)) - expect(bot.client).to receive(:search).with("foo -include:retweets", {:result_type=>"recent"}) + expect(bot.client).to receive(:search).with("foo", {:result_type=>"recent"}) bot.search("foo") end it "passes along since_id" do bot = test_bot allow(bot).to receive(:since_id).and_return(123) allow(bot).to receive(:since_id_reply).and_return(456) allow(bot).to receive(:client).and_return(fake_search(100, 1)) - expect(bot.client).to receive(:search).with("foo -include:retweets", {:since_id => 123, :result_type => "recent", :since_id_reply => 456}) + expect(bot.client).to receive(:search).with("foo", {:since_id => 123, :result_type => "recent", :since_id_reply => 456}) bot.search("foo") end it "updates since_id when complete" do