我正在尝试为我的应用程序编写一个黄瓜功能和 rspec 测试,以使用 twitter-stream 访问 twitter 流 api。我有以下代码:
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
该方法的代码是:
def latest
token = @token.get_token
@stream = Twitter::JSONStream.connect(options)
items = []
@stream.each_item do |item|
items << item
end
items
end
但是,可以预见的是,它在timeline.latest 调用上停滞了。我怎样才能正确测试我的内部逻辑latest
method?
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)