アプリケーションを Rspec 2.3 および Rails 3.0.3 に移行した後、一連の Rspec テストが失敗するようになりました。
例を次に示します。
it "should not be able to access 'destroy'" do
delete :destroy
response.should redirect_to(signin_path)
flash[:error].should == "You must be signed in to view this page."
end
エラーが表示されます:
1) FriendshipsController when not logged in: should not be able to access 'destroy'
Failure/Error: delete :destroy
No route matches {:controller=>"friendships", :action=>"destroy"}
# ./spec/controllers/friendships_controller_spec.rb:21:in `block (3 levels) in <top (required)>'
routes.rb ファイルで、このコントローラーのリソースをマッピングしました...
resources :friendships
同じ
get :edit
get :show
put :update
機能しているように見えるのは1つだけです
post :create
しかし、これは100%断言できません。
何かご意見は?御時間ありがとうございます!
アップデート:
get :new
も機能し、私の UserSessions コントローラー (Authlogic) はこの問題に悩まされていないようです。UserSessions コントローラー、モデル、またはテストで私が行ったことは何もありません。