-
-
Notifications
You must be signed in to change notification settings - Fork 122
Open
Milestone
Description
We have a --server-config option for the console command to load the full Roda stack, but we don't actually have an obvious way of testing routes in the console. I spent some time playing around with getting Rack Test loaded, and it turns out to be surprisingly easy!
gem "rack-test" # add this to your Gemfile
# then when you run `bin/bridgetown console --server-config`:
require "rack/test"
IRB::ExtendCommandBundle.include Rack::Test::Methods
def app = RodaApp.app
get '/'
doc = Nokolexbor::Document.parse get("/").body
doc.query_selector("h2").inner_html # inspect your response
get("/preview/docs/_docs%2Findex.md").body # => test a dynamic server routeI think what we should do is add conditional code in the console command for the server boot where, if the "rack-test" gem is available, we set up these commands. If not, no worries! Then we can add documentation for folks to add "rack-test", and also it can be part of our overall Minitest bundled configuration aka #570.
Metadata
Metadata
Assignees
Labels
No labels