我无法理解这个问题。基本上,我在这里尝试的是获取一个特定页面,该页面使用Twitter gem和API来检索我的帐户的推文列表,并使用gem,capybara和
等宝石测试和批准此方法app.rb:
require 'sinatra'
require 'twitter'
config = {
:consumer_key => '...' ,
:consumer_secret => '...' ,
:access_token => '...' ,
:access_token_secret => '...'
}
get '/list_of_tweets' do
tweets = client.user_timeline(user)
@history = tweets.take(20)
unless @params[:operation].nil?
if @params[:operation] == 'favorite_count'
@history.sort_by!{|tweet| tweet.favorite_count}
@history.reverse!
elsif @params[:operation] == 'retweet_count'
@history.sort_by!{|tweet| tweet.retweet_count}
@history.reverse!
end
end
list_of_tweets.feature:
Feature: list of tweets
Scenario: Fetching list of tweets
Given I am on the list of tweets page
Then I should see all my tweets
step_definitions:
Given /^I am on the list of tweets page$/ do
visit ui_url '/list_of_tweets'
end
Then /^I should see all my tweets$/ do
@history.each do |tweet|
end
end
path.rb:
module NavigationHelpers
def path_to(page_name)
case page_name
when /the list of tweets page/
'/list_of_tweets'
end
end
World(NavigationHelpers)
我在这里缺少什么?我是这些宝石的新手