matthewcrist/mock-response — pull request #2 by thenickperson (2013-08-12 17:34:47+00:00)
Title: Tests

I wrote a simple test suite for checking the status codes for all the status page routes (with all 6 HTTP verbs). It also checks to make sure that the home and 404 pages work as expected.

Testing stack:
- RSpec: test framework
- You can run `rake spec` or just `rake` to run the tests.
- simplecov: code coverage
- Code coverage should be at 100%, but Travis builds have much lower coverage (see issues below).
- Travis: continuous integration
- This is testing on Ruby 1.9.3 and 2.0.0.
- Travis is currently building off of my `tests` branch in my fork. If you merge this, you will probably need to log into Travis and set it up for your repo. You won't need to create the config file, though, as I already did this.

Notes:
- I moved the status code hash into a separate YAML file, since I had a hard time accessing this variable from the Sinatra app instance in the tests. This may not be necessary, but I personally think it's cleaner to have these in a separate file anyway.
- I'm not the best at RSpec, so the tests could probably be organized better and made a bit more DRY.

Issues:
- The tests take a while (usually around 3-4 minutes) because the `/timeout` route takes 28 seconds per run, and it has to happen 6 times for each HTTP verb.
- This is currently at 100% code coverage for me when I run the tests locally, but for some reason this is not the case on Travis. When simplecov runs on Travis, it makes it seem like this repo has several thousand lines of code, which is kind of odd.