Route Rspec

Testing Routes

Testing routes in Sinatra requires a ruby gem called Rack-Test that is built upon RSpec. You run these tests using RSpec in the console, and since RSpec is a DSL, you should try to remember the proper syntax. Here are a few examples of Rack-Tests. Note that you can test HTTP status (cats).

One thing that our DBC teacher mentioned in setting up our tests is to use the three a's

  1. arrange: prepare the test with w/e you need to create
  2. act: submit the test
  3. assert: test the test.(Redundant, I know.)

Below is an image of his HTTP route Rspec tests.