Sha256: 22ad6e3368e88f1ec5f7f0e827ff6bbfdd2088281ddca8d3b311b93632c5cb96
Contents?: true
Size: 1.01 KB
Versions: 4
Compression:
Stored size: 1.01 KB
Contents
require 'assert' require 'rack/utils' require 'deas/show_exceptions' class Deas::ShowExceptions class BaseTests < Assert::Context desc "Deas::ShowExceptions" setup do exception = nil begin; raise 'test'; rescue Exception => exception; end @app = proc do |env| env['sinatra.error'] = exception [ 500, {}, [] ] end @exception = exception @show_exceptions = Deas::ShowExceptions.new(@app) end subject{ @show_exceptions } should have_imeths :call, :call! should "return a body that contains details about the exception" do status, headers, body = subject.call({}) expected_body = "#{@exception.class}: #{@exception.message}\n" \ "#{@exception.backtrace.join("\n")}" expected_body_size = Rack::Utils.bytesize(expected_body).to_s assert_equal expected_body_size, headers['Content-Length'] assert_equal "text/plain", headers['Content-Type'] assert_equal [expected_body], body end end end
Version data entries
4 entries across 4 versions & 1 rubygems