I am trying to write a cucumber function and rspec tests for my twitter streaming api twitter feed application. I have the following code:
Then /^I should see the latest (\d+) tweets from my timeline$/ do |num| timeline = Starling::Timeline::Mine.new(@store) EventMachine::run { tweets = timeline.latest timeline.stop } tweets.length.should == num.to_i end
method code:
def latest token = @token.get_token @stream = Twitter::JSONStream.connect(options) items = [] @stream.each_item do |item| items << item end items end
But, as predicted, he stops at the timeline. How to check logic inside latest
method correctly?
source share