Ruby On Rails Lesson
Although we’ll keep individual user show pages visible to all site visitors, the user index will be restricted to signed-in users so that there’s a limit to how much unregistered users can see by default. We’ll start by testing that the index action is protected by visiting the users_path (Table 7.1) and verifying that we are redirected to the signin page. As with other authorization tests, we’ll put this example in the authentication integration test, as shown in Listing 9.21.
Figure 9.7 A mockup of the user index, with pagination and a ‘‘Users’’ nav link.