Sinatra now provides sensible options for testing
In the lastest release, 0.9.1: * Set sensible defaults on Default for test env [1]5a33a9586f
* Set :environment to :test in TestHarness9af37724e0
* Set :environment to :test when Sinatra::Test is included93b19a3492
[1] Only Sinatra::Default provides special options for testing. If you subclass Sinatra::Base, you'll have to set them yourself. foo
This commit is contained in:
parent
4e07f5b654
commit
90baf3311c
@ -10,16 +10,7 @@ module Webrat
|
|||||||
def initialize(context = nil)
|
def initialize(context = nil)
|
||||||
super(context)
|
super(context)
|
||||||
|
|
||||||
app =
|
app = context.respond_to?(:app) ? context.app : Sinatra::Application
|
||||||
if context.respond_to?(:app)
|
|
||||||
context.app
|
|
||||||
else
|
|
||||||
Sinatra::Application.tap { |app|
|
|
||||||
app.set :environment, :test
|
|
||||||
app.disable :run, :reload
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
@browser = Sinatra::TestHarness.new(app)
|
@browser = Sinatra::TestHarness.new(app)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -3,10 +3,7 @@ require File.dirname(__FILE__) + "/../modular_app"
|
|||||||
|
|
||||||
class MyModularAppTest < Test::Unit::TestCase
|
class MyModularAppTest < Test::Unit::TestCase
|
||||||
def app
|
def app
|
||||||
MyModularApp.tap { |app|
|
MyModularApp
|
||||||
app.disable :run, :reload
|
|
||||||
app.set :environment, :test
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_it_works
|
def test_it_works
|
||||||
|
Loading…
Reference in New Issue
Block a user