I want to test whether
- My home “/” ends up in right controller and action
- Whether “/” it returns success
I wrote this in my routes.rb
root :to => "pages#home"
and wrote this test in my test/functionals.
require 'test_helper'
class PagesControllerTest < ActionController::TestCase
def test_home_page
get :home
assert_response :success
end
end
And it returned success. But actually, this test cases tests the actual controller and not the home page root route and its success. How else can I get my required tests? please help.
You can create routing test in spec/routing/pages_controller_routing_spec. In rspec: