1
레일스 3을 배우기 위해서 제 자신의 블로그를 만들고 있습니다. 직접적인 경로가없는 레일즈 컨트롤러 동작 테스트하기
/blog/year/month/slug
그래서 내 routes.rb이 같은 설정이 있습니다 :
내 URL이를 포맷 할 필요가 웹 브라우저를 통해
Blog::Application.routes.draw do
match '/blog', :to => 'post#index'
match 'blog/:year/:month/:slug', :to => 'post#show'
root :to => 'post#index'
...
시험이 잘 작동합니다. 문제는 PostController의 show
조치 메소드를 테스트하려고 할 때 발생합니다.
나는이 테스트 실행 : 내 포스트 컨트롤러에 show 액션 방법을 실행할 수 있도록
ActionController::RoutingError: No route matches {:controller=>"post", :action=>"show"}
가 어떻게 내 테스트를 작성할 수 있습니다
class PostControllerTest < ActionController::TestCase
test "can get a post by slug" do
get :show
assert_response :success
end
end
을 나는이 오류가?