Sha256: fea2904530449368a17dbdefe33295115b765d97d7087de1348eb31665128d44

Contents?: true

Size: 1003 Bytes

Versions: 18

Compression:

Stored size: 1003 Bytes

Contents

require 'assert'
require 'rack/utils'
require 'deas/show_exceptions'

class Deas::ShowExceptions

  class BaseTests < Assert::Context
    desc "Deas::ShowExceptions"
    setup do
      exception = Sinatra::NotFound.new
      @app = proc do |env|
        env['sinatra.error'] = exception
        [ 404, {}, [] ]
      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

18 entries across 18 versions & 1 rubygems

Version Path
deas-0.24.1 test/unit/show_exceptions_tests.rb
deas-0.24.0 test/unit/show_exceptions_tests.rb
deas-0.23.4 test/unit/show_exceptions_tests.rb
deas-0.23.3 test/unit/show_exceptions_tests.rb
deas-0.23.2 test/unit/show_exceptions_tests.rb
deas-0.23.1 test/unit/show_exceptions_tests.rb
deas-0.23.0 test/unit/show_exceptions_tests.rb
deas-0.22.1 test/unit/show_exceptions_tests.rb
deas-0.22.0 test/unit/show_exceptions_tests.rb
deas-0.21.0 test/unit/show_exceptions_tests.rb
deas-0.20.0 test/unit/show_exceptions_tests.rb
deas-0.19.0 test/unit/show_exceptions_tests.rb
deas-0.18.0 test/unit/show_exceptions_tests.rb
deas-0.17.1 test/unit/show_exceptions_tests.rb
deas-0.17.0 test/unit/show_exceptions_tests.rb
deas-0.16.0 test/unit/show_exceptions_tests.rb
deas-0.15.0 test/unit/show_exceptions_tests.rb
deas-0.14.1 test/unit/show_exceptions_tests.rb