0
我有一個特點,像這樣的重定向黃瓜HOWTO以下
Scenario: can't find similar movies if we don't know director (sad path)
Given I am on the details page for "Alien"
Then I should not see "Ridley Scott"
When I follow "Find Movies With Same Director"
Then I should be on the home page
Then I should see "'Alien' has no director info"
我有控制器行動「查找電影同一導演」命名find_by_same_director,也有一個視圖模板具有相同的場景名字,但看電影的時候沒有一個導演的電影同樣應該採取的主頁,我做到這一點,在這樣的控制器動作..
def find_by_same_director
m = Movie.find params[:id]
@similar_movies = m.similar_movies
if @similar_movies.count == 0
flash[:notice] = "#{m.title} has no director info"
render :index
end
end
而且在paths.rb path_to方法「的主頁'情況如此
when /^the home\s?page$/
movies_path
要通過一步那麼我應該在主頁我應該怎麼做呢?謝謝