Following up on how to test a config.ru, an actual patch
http://github.com/timocratic/rack-test/commit/dd5324627890b4632c07deed1fc2528...Comments [0]
Comments [0]
The ever useful rack-test gem let's you easily integration test any rack project. All you have to do is include the Rack::Test::Methods and define an app method that returns your rack app. So people usually have a config.ru that just references their my_application.rb that they reference in their config.ru and then in their test file they can also reference that app and return it. Something to to this effect:
I had a project where I was actually trying to better breakdown a more complex app, and I wanted to just be able to use Rack's built-in map method at the top level of my config.ru to route to different apps. And in at least some of the cases I wanted to be able to test the whole thing. Also, I figured sometimes it's useful to actually be able to test your rackup file itself, all routing/mapping included. So I dug around in the rack code and found how the rackup command handles the .ru file, and came up with this:
Update
If you are running off of a new enough version of rack, you could also just use Rack::Builder.parse_file
Comments [0]
An imported post from my old blog. Hopefully the title is self-explantory.
Comments [0]
An imported post from my old blog. Hopefully the title is self-explantory.
Comments [0]
An imported post from my old blog. Hopefully the title is self-explantory.
Comments [0]
An imported post from my old blog. Hopefully the title is self-explantory.
Comments [0]
An imported post from my old blog. Hopefully the title is self-explantory.
Comments [0]
An imported post from my old blog. Hopefully the title is self-explantory.
Comments [0]
An imported post from my old blog. Hopefully the title is self-explantory.
Comments [0]
An imported post from my old blog. Hopefully the title is self-explantory.
Comments [0]