From 90baf3311c582390522c30d434ac3afe7822cb69 Mon Sep 17 00:00:00 2001 From: Simon Rozet Date: Sun, 8 Mar 2009 23:30:17 +0100 Subject: [PATCH] Sinatra now provides sensible options for testing In the lastest release, 0.9.1: * Set sensible defaults on Default for test env [1] http://github.com/sinatra/sinatra/commit/5a33a9586f6d3aa959ee7b3f4f7f0831476dcaa5 * Set :environment to :test in TestHarness http://github.com/sinatra/sinatra/commit/9af37724e0fa5413c9a089024526ace6f82b7ab9 * Set :environment to :test when Sinatra::Test is included http://github.com/sinatra/sinatra/commit/93b19a34927a21880523d3301b51d1dc2aad6538 [1] Only Sinatra::Default provides special options for testing. If you subclass Sinatra::Base, you'll have to set them yourself. foo --- lib/webrat/sinatra.rb | 11 +---------- spec/integration/sinatra/test/modular_app_test.rb | 5 +---- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/lib/webrat/sinatra.rb b/lib/webrat/sinatra.rb index 08ba366..efaa491 100644 --- a/lib/webrat/sinatra.rb +++ b/lib/webrat/sinatra.rb @@ -10,16 +10,7 @@ module Webrat def initialize(context = nil) super(context) - app = - if context.respond_to?(:app) - context.app - else - Sinatra::Application.tap { |app| - app.set :environment, :test - app.disable :run, :reload - } - end - + app = context.respond_to?(:app) ? context.app : Sinatra::Application @browser = Sinatra::TestHarness.new(app) end diff --git a/spec/integration/sinatra/test/modular_app_test.rb b/spec/integration/sinatra/test/modular_app_test.rb index 18f6909..214ec36 100644 --- a/spec/integration/sinatra/test/modular_app_test.rb +++ b/spec/integration/sinatra/test/modular_app_test.rb @@ -3,10 +3,7 @@ require File.dirname(__FILE__) + "/../modular_app" class MyModularAppTest < Test::Unit::TestCase def app - MyModularApp.tap { |app| - app.disable :run, :reload - app.set :environment, :test - } + MyModularApp end def test_it_works