2013-04-07 123 views
2

使用Ruby on Rails和我正在編寫步驟定義,以便我可以運行黃瓜。不過,我有一個訪問頁面的普通高清和黃瓜不能找到我給它的路徑:黃瓜上的步驟定義沒有在Ruby on Rails上找到路徑

Can't find mapping from "the Brainstormy home index page" to a path. 

這是步驟定義:

Given /^(?:|I)am on (.+)$/ do |page_name| 
    visit path_to(page_name) 
end 

這裏是情景:

Scenario: Sign up for Brainstormy 

Given I am on the Brainstormy home index page 
When I fill in "firstName" with "John" 
And I fill in "lastName" with "Adams" 
And I fill in "email" with "[email protected]" 
And I fill in "email2" with "[email protected]" 
And I fill in "password" with "spot1234" 
And I fill in "password2" with "spot1234" 
And I press "Sign Up" 
Then I should be on the profile page 

我的路線:

home_index  /home/index(.:format)  home#index 
root   /      home#index 

My routes.rb:

root :to => 'home#index' 
resources :ideas 
resources :users 

#root :to => redirect('/home/index') 
match 'home/index' => 'home#index' 
match 'users/new' => 'users#new' 

事情是,我沒有寫定義。我從一個正在運行的應用程序中獲得它,並基本上將它們做了鏡像。有人可以幫我解決這個問題嗎?

回答

2

看看path_to的方法。這將是從人類可讀字符串到URL的某種映射。你將不得不添加一個映射"Brainstormy home index page"去任何你想要的URL。如果您需要其他幫助,請在您的帖子中包含path_to方法。