aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2015-12-08Delete config.rusolutionTeddy Wing
As of 28770a5143bb5b48389d5ad4ce235625c12f1056 we no longer need this file as the server should now be started with `ruby app.rb` instead of `rackup`.
2015-12-08Add logged_in.erb templateTeddy Wing
Template that displays when the user is logged in. Adjust the login test to check for the text in this template.
2015-12-08Add layout.erbTeddy Wing
Move boilerplate code from `index.erb` into `layout.erb` to allow us to use it in additional templates.
2015-12-08auth_test.rb: Add logout testTeddy Wing
2015-12-08auth_test.rb: Create login helpersTeddy Wing
Create a couple new methods to extract login functionality and remove duplicate test code.
2015-12-08index.erb: Make password field `type=password`Teddy Wing
So that the characters get masked.
2015-12-08Add test for unrecognised userTeddy Wing
When logging in with unrecognised credentials, the response should include "Unrecognized user".
2015-12-08app.rb: Add basic session handlingTeddy Wing
When logging in with the correct credentials, set a session variable and redirect to the login page. Custom display for a user who is logged in. Add a logout method to delete the session variable, thus logging out the user. Use Rack's built-in session cookies to facilitate session management.
2015-12-08app.rb: Remove Sinatra::Base application wrapperTeddy Wing
Don't wrap our routes/controllers in a `Sinatra::Base` class to keep things simple. Was doing this because I thought I needed to in order to be able to tell Capybara where the application was but looking at the Sinatra testing page (http://www.sinatrarb.com/testing.html), they provide an example for Capybara that details this `Sinatra::Application.new` call that I can make instead. This frees us up to use the simplified application definition.
2015-12-08test_helper: Set `RACK_ENV` = 'test'Teddy Wing
Saw this on the Sinatra testing page (http://www.sinatrarb.com/testing.html). Seems like I should put it in to be a good Rack citizen.
2015-12-08app.rb: Add a POST receiver to '/'Teddy Wing
Make the tests pass by adding a POST handler for the index route.
2015-12-08Add test that fills in login formTeddy Wing
* Write a `setup` method to extract the '/' route visit * Change the logic of `test_index_has_login_form` to check for the presence of 'Login' text and a form (super basic) * Create a new test that fills in the login form and clicks the "Login" button. For now just checks that we get a successful response.
2015-12-08index.erb: Add login formTeddy Wing
2015-12-07Render index templateTeddy Wing
Instead of responding with "Hello World", render a full ERB template so we can display HTML with form fields.
2015-12-07Add config.ruTeddy Wing
Now that we use the `Sinatra::Base` application, we have to tell the server to run our application class. We do this by specifying a Rack config file. Now instead of running $ ruby app.rb to start the app server, we run $ rackup
2015-12-07Add a simple Capybara testTeddy Wing
* Add Rakefile to run tests with `rake` * Add a `test_helper` to take care of the setup that Capybara requires in order to run * Add a super basic test to see if Capybara works * Put app in a `Sinatra::Base` subclass so that we can tell Capybara where to find it
2015-12-07Gemfile: Install 'capybara'Teddy Wing
For integration testing.
2015-12-07Add app.rbTeddy Wing
Create a dummy Sinatra app that gives a "Hello World" response from the index.
2015-12-07Gemfile: Install 'rerun' gemTeddy Wing
To be able to reload Sinatra when changes are made.
2015-12-07Add setup.shTeddy Wing
A setup file for initialising the project.
2015-12-07Add .gitignoreTeddy Wing
Ignore Bundler directories.
2015-12-07Initial commit. Add Gemfile.Teddy Wing
Use Sinatra.