spec/tweetstream_spec.rb in tweetstream-2.5.0 vs spec/tweetstream_spec.rb in tweetstream-2.6.0

- old
+ new

@@ -2,11 +2,11 @@ describe TweetStream do context "when delegating to a client" do before do - @stream = stub("EM::Twitter::Client", + @stream = double("EM::Twitter::Client", :connect => true, :unbind => true, :each_item => true, :on_error => true, :on_max_reconnects => true, @@ -14,16 +14,16 @@ :connection_completed => true, :on_no_data_received => true, :on_unauthorized => true, :on_enhance_your_calm => true ) - EM.stub!(:run).and_yield - EM::Twitter::Client.stub!(:connect).and_return(@stream) + allow(EM).to receive(:run).and_yield + allow(EM::Twitter::Client).to receive(:connect).and_return(@stream) end it "returns the same results as a client" do - Yajl::Parser.should_receive(:parse).twice.and_return({}) - @stream.should_receive(:each).and_yield(sample_tweets[0].to_json) + expect(MultiJson).to receive(:decode).and_return({}) + expect(@stream).to receive(:each).and_yield(sample_tweets[0].to_json) TweetStream.track('abc','def') end end describe ".new" do