spec/retweet_spec.rb in chatterbot-0.7.1 vs spec/retweet_spec.rb in chatterbot-0.9.0
- old
+ new
@@ -5,23 +5,31 @@
before(:each) do
@bot = test_bot
end
it "calls require_login when tweeting" do
- @bot.should_receive(:require_login).and_return(false)
+ expect(@bot).to receive(:require_login).and_return(false)
@bot.retweet "tweet test!"
end
- it "calls client.retweet with the right values" do
- bot = test_bot
+ context "data" do
+ before(:each) do
+ expect(@bot).to receive(:require_login).and_return(true)
+ allow(@bot).to receive(:client).and_return(double(Twitter::Client))
- bot.should_receive(:require_login).and_return(true)
- bot.stub(:client).and_return(mock(Twitter::Client))
+ allow(@bot).to receive(:debug_mode?).and_return(false)
+ end
- bot.stub(:debug_mode?).and_return(false)
+ it "calls client.retweet with an id" do
+ tweet_id = 12345
+ expect(@bot.client).to receive(:retweet).with(tweet_id)
+ @bot.retweet(tweet_id)
+ end
- tweet_id = 12345
- bot.client.should_receive(:retweet).with(tweet_id)
- bot.retweet(tweet_id)
+ it "calls client.retweet with a tweet" do
+ t = Twitter::Tweet.new(:id => 7890, :text => "did you know that i hate bots?")
+ expect(@bot.client).to receive(:retweet).with(7890)
+ @bot.retweet(t)
+ end
end
end
end