Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Requiring Login1:52 with Jason Seifer
It is important to restrict parts of our application to only users who are logged in. This video starts the process of requiring users to be logged in before posting status updates.
Now that we have the test passing,
let's give it a more descriptive name.
And finally, let's make sure that we can actually get the new page when we are logged in.
Now, in order to do this, we're going to need some way of logging in first.
Luckily for us, Devise provides some of that functionality in our tests.
If we go back to the Devise documentation
and scroll down to testing, we can see what helper methods we have available.
It looks like what we use is sign in and pass it by user object.
Let's try that in our code.
We're going to say sign in the jason user.
Then we're going to get the new page
and make sure that that was successful.
Now let's run this test again and see what happens.
It looks like it passed.
We've done a lot of work up until this point,
so it would be a good spot for us to commit.
Let's type 'git status'.
It looks like we added the custom routes integration test,
so let's add that to our commit.
Now let's commit all of this.
Our message is going to be "Added tests for custom routes".
You need to sign up for Treehouse in order to download course files.Sign up