spec/followers_spec.rb in chatterbot-0.7.1 vs spec/followers_spec.rb in chatterbot-0.9.0

- old
+ new

@@ -1,19 +1,40 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe "Chatterbot::Followers" do - it "calls require_login" do - bot = test_bot - bot.should_receive(:require_login).and_return(false) - bot.followers + before(:each) do + @bot = test_bot end - it "returns followers" do - bot = test_bot - bot.should_receive(:require_login).and_return(true) - bot.stub(:client).and_return(fake_followers(3)) + describe "followers" do + it "calls require_login" do + expect(@bot).to receive(:require_login).and_return(false) + @bot.followers + end - result = bot.followers - result.size.should == 3 - result[0].name.should == "Follower 1" + it "returns followers" do + expect(@bot).to receive(:require_login).and_return(true) + allow(@bot).to receive(:client).and_return(fake_followers(3)) + + result = @bot.followers + expect(result.size).to eq(3) + expect(result[0].name).to eq("Follower 1") + end end + + describe "follow" do + it "calls require_login" do + expect(@bot).to receive(:require_login).and_return(false) + @bot.follow(1234) + end + + it "works" do + expect(@bot).to receive(:require_login).and_return(true) + allow(@bot).to receive(:client).and_return(double(Twitter::Client)) + expect(@bot.client).to receive(:follow).with(1234) + + @bot.follow(1234) + end + end + + end