test/spec_showexceptions.rb in rack-1.6.10 vs test/spec_showexceptions.rb in rack-1.6.11
- old
+ new
@@ -80,6 +80,19 @@
res.should =~ /RuntimeError/
res.should =~ /ShowExceptions/
res.should =~ /unknown location/
end
+
+ it "knows to prefer plaintext for non-html" do
+ # We don't need an app for this
+ exc = Rack::ShowExceptions.new(nil)
+
+ [
+ [{ "HTTP_ACCEPT" => "text/plain" }, true],
+ [{ "HTTP_ACCEPT" => "text/foo" }, true],
+ [{ "HTTP_ACCEPT" => "text/html" }, false]
+ ].each do |env, expected|
+ assert_equal(expected, exc.prefers_plaintext?(env))
+ end
+ end
end