Skip to content

Instantly share code, notes, and snippets.

@biscuitvile
Created February 4, 2014 04:00
Show Gist options
  • Select an option

  • Save biscuitvile/8797951 to your computer and use it in GitHub Desktop.

Select an option

Save biscuitvile/8797951 to your computer and use it in GitHub Desktop.
test_helper for sinatra
require 'rubygems'
require 'test/unit'
require 'rack/test'
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'sinatra/erector'
class Test::Unit::TestCase
include Rack::Test::Methods
attr_reader :app
# Sets up a Sinatra::Base subclass defined with the block
# given. Used in setup or individual spec methods to establish
# the application.
def mock_app(base=Sinatra::Base, &block)
@app = Sinatra.new(base, &block)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment