Logging out
At the moment we can create a user and we can allow her/him to log in. We also need to give her/him a chance to log out, right? Then of course we should have a profile page and a feature to allow the user to update his credentials and so on. That is outside of the scope of this exercise but you will be given plenty of opportunities to add these features yourself once you have mastered the Sinatra framework and ruby.
Add more steps to the log out scenario:
Add the following step definition, again reusing some previous steps:
Add the /users/logout
route to application.rb
Update your application.erb
by adding the Log in link:
The scenario should pass. We now have a registration, log in and log out features in place.
What else? For now we will leave the User
class as it is. For the sake of the exercise we have all the basic functionality we need, but to be honest, we would need to add a few more features to User
before we can use it in production. For instance, we do not validate the uniqueness of the email
during registration meaning that two users could register with the same email address. Is that okay? Think about that for a moment. Can you come up with some other functionality that could prove useful or even mission critical?
Last updated