Skip to content

Instantly share code, notes, and snippets.

@tannerburson
Created May 18, 2009 20:36
Show Gist options
  • Select an option

  • Save tannerburson/113727 to your computer and use it in GitHub Desktop.

Select an option

Save tannerburson/113727 to your computer and use it in GitHub Desktop.
#This should insert all the rack test methods into your current test context.
#Modify as appropriate for your specific test framework.
#If you're including the Sinatra::Test in each of your tests, you'll need to
#include Rack::Test::Methods instead.
Test::Unit::TestCase.send :include, Sinatra::Test
#becomes
Test::Unit::TestCase.send :include, Rack::Test::Methods
#This is a pretty minor change, but probably needs to be changed in
#all of your sinatra tests.
before { @app = Web::Application }
#becomes
def app
Web::Application
end
#The biggest change, is that Rack::Test doesn't include a method_missing hook.
#This means that this code:
body.should.include 'error'
#becomes
last_response.body.should.include 'error'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment