Declare GET "/"
route
In order to access the GET /
route in UserSharesAMessageTest
,
declare a route using the get
route helper, which delegates its
arguments to the underlying match
route helper, in order to
handle requests made with the GET
HTTP Verb.
The get
declaration accepts options. The controller:
option instructs the router to route requests with the GET
verb and
the "/"
path to the controller name with the corresponding name.
In this commit’s case, controller: "notes"
corresponds to the
NotesController
.
Another option the get
helper accepts is action:
. The value assigned
to the action:
key instructs the router to route requests that match
the criteria to the corresponding controller’s instance method.
In this commit’s case, action: "index"
corresponds to the
NotesController#index
instance method.
Once the route exists, the request made in the test yields a new error:
Error:
UserSharesAMessagesTest#test_visiting_the_index:
ActionController::RoutingError: uninitialized constant NotesController
Did you mean? ActionController