aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application/middleware/show_exceptions_test.rb
diff options
context:
space:
mode:
authorOlli Jokinen <olli.jokinen@enemy.fi>2011-12-01 15:32:59 +0200
committerOlli Jokinen <olli.jokinen@enemy.fi>2011-12-01 15:32:59 +0200
commitb4e1903d23a760028d58bc3bb20a1d491bfd4a4b (patch)
treea40bdce1bd4800124ab6eaed2a6be017bf9cfd3d /railties/test/application/middleware/show_exceptions_test.rb
parentfae9ad9c712decef70b379f5aa1faa0149902831 (diff)
parent1e51cd957e3c90f4be35f1f0c4c380d8f7d40d66 (diff)
downloadrails-b4e1903d23a760028d58bc3bb20a1d491bfd4a4b.tar.gz
rails-b4e1903d23a760028d58bc3bb20a1d491bfd4a4b.tar.bz2
rails-b4e1903d23a760028d58bc3bb20a1d491bfd4a4b.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'railties/test/application/middleware/show_exceptions_test.rb')
-rw-r--r--railties/test/application/middleware/show_exceptions_test.rb41
1 files changed, 30 insertions, 11 deletions
diff --git a/railties/test/application/middleware/show_exceptions_test.rb b/railties/test/application/middleware/show_exceptions_test.rb
index e3f27f63c3..7dbadc6ce3 100644
--- a/railties/test/application/middleware/show_exceptions_test.rb
+++ b/railties/test/application/middleware/show_exceptions_test.rb
@@ -1,27 +1,23 @@
+# encoding: utf-8
require 'isolation/abstract_unit'
+require 'rack/test'
module ApplicationTests
class ShowExceptionsTest < Test::Unit::TestCase
include ActiveSupport::Testing::Isolation
+ include Rack::Test::Methods
def setup
build_app
boot_rails
- FileUtils.rm_rf "#{app_path}/config/environments"
end
def teardown
teardown_app
end
- def app
- @app ||= Rails.application
- end
-
test "unspecified route when set action_dispatch.show_exceptions to false" do
- make_basic_app do |app|
- app.config.action_dispatch.show_exceptions = false
- end
+ app.config.action_dispatch.show_exceptions = false
assert_raise(ActionController::RoutingError) do
get '/foo'
@@ -29,13 +25,36 @@ module ApplicationTests
end
test "unspecified route when set action_dispatch.show_exceptions to true" do
- make_basic_app do |app|
- app.config.action_dispatch.show_exceptions = true
- end
+ app.config.action_dispatch.show_exceptions = true
assert_nothing_raised(ActionController::RoutingError) do
get '/foo'
end
end
+
+ test "displays diagnostics message when exception raised in template that contains UTF-8" do
+ app.config.action_dispatch.show_exceptions = true
+
+ controller :foo, <<-RUBY
+ class FooController < ActionController::Base
+ def index
+ end
+ end
+ RUBY
+
+ app_file 'app/views/foo/index.html.erb', <<-ERB
+ <% raise 'boooom' %>
+ ✓
+ ERB
+
+ app_file 'config/routes.rb', <<-RUBY
+ AppTemplate::Application.routes.draw do
+ match ':controller(/:action)'
+ end
+ RUBY
+
+ post '/foo', :utf8 => '✓'
+ assert_match(/boooom/, last_response.body)
+ end
end
end