Ruby 黄瓜试验机
我正在尝试为我的应用程序编写一个cucumber特性和rspec测试,用于使用twitter流访问twitter流api。我有以下代码:Ruby 黄瓜试验机,ruby,cucumber,eventmachine,Ruby,Cucumber,Eventmachine,我正在尝试为我的应用程序编写一个cucumber特性和rspec测试,用于使用twitter流访问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 tim
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
def最新版本
令牌=@token.get\u令牌
@stream=Twitter::JSONStream.connect(选项)
项目=[]
@stream.u每个|项做|项|
你说的摊位是什么意思?它正在从twitter服务器请求数据?还有别的吗?