Skip to content

Commit

Permalink
Sinatra now provides sensible options for testing
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sr committed Mar 8, 2009
1 parent 4e07f5b commit 90baf33
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
11 changes: 1 addition & 10 deletions lib/webrat/sinatra.rb
Expand Up @@ -10,16 +10,7 @@ class SinatraSession < RackSession
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

Expand Down
5 changes: 1 addition & 4 deletions spec/integration/sinatra/test/modular_app_test.rb
Expand Up @@ -3,10 +3,7 @@

class MyModularAppTest < Test::Unit::TestCase
def app
MyModularApp.tap { |app|
app.disable :run, :reload
app.set :environment, :test
}
MyModularApp
end

def test_it_works
Expand Down

0 comments on commit 90baf33

Please sign in to comment.