Rails root test

root, ruby-on-rails, testing

Solution

I assume you are following the "Ruby on Rails Tutorial" by Micheal Hartl?

Specifically this step: Listing 3.42: A test for the root route

Although not explicitly disclosed in the tutorial (correct me if im wrong)...

I believe the solution below will pass your test. I tried it myself to double check.

test "should get root" do
  get '/'
  assert_response :success
end

Additional reading can be found here: Rails Guide - Integration Tests

Similar Posts: By filling in the code marked FILL_IN in Listing 3.42, write a test for the root route

Thanks @AlterLagos

Problem

I am a beginner and am trying to test whether the following code maps to the "home page": ``` Rails.application.routes.draw do root 'static_pages#home' end ``` what should I replace the first and second "FILL_IN" with in the block below? ``` test "should get root" do get FILL_IN assert_response FILL_IN end ``` Would appreciate your help!

Original source