Hi all, i wrote a Rspec test for my controller and it fails although it should pass. Here is my Rspec test:
require 'spec_helper'
describe UsersController do render_views
describe "GET 'show'" do it "returns http success" do get 'show' response.should be_success end
it "should have the right title" do get 'show' response.should have_selector("title",:content => " | User") end end
end
The test fails with this message:
Failures:
1) UsersController GET 'show' returns http success Failure/Error: get 'show' ActionController::RoutingError: No route matches {:controller=>"users", :action=>"show"} # ./spec/controllers/users_controller_spec.rb:20:in `block (3 levels) in <top (required)>'
2) UsersController GET 'show' should have the right title Failure/Error: get 'show' ActionController::RoutingError: No route matches {:controller=>"users", :action=>"show"} # ./spec/controllers/users_controller_spec.rb:25:in `block (3 levels) in <top (required)>'
The controller is already created also the view. I got the method show in the users controller. I also added the resources :users to my routes.rb. I am able to reach the page without problems. I also checked the rake routes and they are available for this test so it should go green.
Maybe someone see an error and can help me out with this. It would be great.
Thanks and regards
Greg