-
-
Save sohooo/260245 to your computer and use it in GitHub Desktop.
Sinatra Rack Testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra_app' | |
require 'test/unit' | |
require 'rack/test' | |
set :environment, :test | |
class SinatraAppTest < Test::Unit::TestCase | |
include Rack::Test::Methods | |
# Make all tests transactional. | |
def run(result) | |
DB.transaction do | |
super | |
raise(Sequel::Rollback) | |
end | |
end | |
def app | |
Sinatra::Application | |
end | |
def test_index | |
get '/' | |
assert last_response.ok? | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment