Skip to content

Commit

Permalink
turn raise_errors on for ease of debugging the sample app
Browse files Browse the repository at this point in the history
disable it temporarily for the spec that needs that
  • Loading branch information
knzconnor committed Oct 22, 2010
1 parent f72f070 commit 64dc372
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
6 changes: 2 additions & 4 deletions spec/fixtures/config.ru
Expand Up @@ -3,8 +3,6 @@ require "rubygems"
$LOAD_PATH.unshift File.dirname(__FILE__)
require "sample_app"

$LOAD_PATH.unshift File.dirname(__FILE__) + '/../../lib'
require "rack/bug"

use Rack::Bug, :password => "secret"
#Example usage, but moved inside sample app for easier testing
#use Rack::Bug, :password => "secret"
run SampleApp
9 changes: 9 additions & 0 deletions spec/fixtures/sample_app.rb
@@ -1,7 +1,16 @@
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../../lib'
require "rack/bug"

require "sinatra/base"

class SampleApp < Sinatra::Base
use Rack::Bug
set :environment, 'test'

configure :test do
set :raise_errors, true
end

get "/redirect" do
redirect "/"
end
Expand Down
2 changes: 2 additions & 0 deletions spec/rack/toolbar_spec.rb
Expand Up @@ -37,7 +37,9 @@
end

it "does not modify server errors" do
app.disable :raise_errors
response = get "/error"
app.enable :raise_errors
response.should_not have_selector("div#rack_bug")
end

Expand Down
5 changes: 1 addition & 4 deletions spec/spec_helper.rb
Expand Up @@ -42,10 +42,7 @@ class Base
end

def app
Rack::Builder.new do
use Rack::Bug
run SampleApp.new
end
SampleApp
end

def have_row(container, key, value = nil)
Expand Down

0 comments on commit 64dc372

Please sign in to comment.