Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

set RACK_ENV in test/helper.rb to ensure sane environment

  • Loading branch information...
commit f3ce6899652af722c69dd6ffdc11829251251e02 1 parent 3b9578f
@rtomayko rtomayko authored
Showing with 8 additions and 2 deletions.
  1. +2 −0  test/helper.rb
  2. +6 −2 test/routing_test.rb
View
2  test/helper.rb
@@ -1,3 +1,5 @@
+ENV['RACK_ENV'] = 'test'
+
begin
require 'rack'
rescue LoadError
View
8 test/routing_test.rb
@@ -44,15 +44,19 @@ class RoutingTest < Test::Unit::TestCase
assert_equal 404, status
end
- it "sets the content-type to text/html in the default 404 handler" do
+ it "overrides the content-type in error handlers" do
mock_app {
before { content_type 'text/plain' }
+ error Sinatra::NotFound do
+ content_type "text/html"
+ "<h1>Not Found</h1>"
+ end
}
get '/foo'
assert_equal 404, status
assert_equal 'text/html', response["Content-Type"]
- assert body.include?("Sinatra doesn't know this ditty")
+ assert_equal "<h1>Not Found</h1>", response.body
end
it 'takes multiple definitions of a route' do
Please sign in to comment.
Something went wrong with that request. Please try again.