PAGE NO LONGER MAINTAINED, all articles were moved to http://www.eq8.eu/tils where I'll continue adding more !
This page contains simple small Ruby on Rails and web-development hints that are too small for a real blog. You can visit my real blog at http://www.eq8.eu
Friday, December 12, 2014
change Rack Test default host
If you're using Rack Test to test requests on your Sinatra application you will notice that by default the host isexample.org.
you can change this like this:
# spec/spec_helper.rbdefappMySinatraOrRackAppendmoduleRackmoduleTestmoduleMethodsdefbuild_rack_mock_sessionRack::MockSession.new(app, 'api.myapp.com')
endendendend# this has to be done before you do `include Rack::Test::Methods`
note: Rack Test is the lib that is repsonsible for request test, so when you do post('/events'), get('/', token: 123), ...