Sha256: b594e2eb6b447b24d140cda926681be3a7ecc5575188c6f7c507b4290f22307e

Contents?: true

Size: 1.23 KB

Versions: 7

Compression:

Stored size: 1.23 KB

Contents

require 'assert'
require 'deas/exceptions'

module Deas

  class ErrorTests < Assert::Context
    desc "Deas"

    should "provide an error exception that subclasses `RuntimeError" do
      assert Deas::Error
      assert_kind_of RuntimeError, Deas::Error.new
    end

    should "provide a no handler class exception" do
      assert Deas::NoHandlerClassError

      handler_class_name = 'AHandlerClass'
      e = Deas::NoHandlerClassError.new(handler_class_name)
      exp_msg = "Deas couldn't find the view handler '#{handler_class_name}'" \
                " - it doesn't exist or hasn't been required in yet."

      assert_kind_of Deas::Error, e
      assert_equal exp_msg, e.message
    end

    should "provide a server exception" do
      assert Deas::ServerError
      assert_kind_of Deas::Error, Deas::ServerError.new
    end

    should "provide a server root exception" do
      assert Deas::ServerRootError

      e = Deas::ServerRootError.new
      assert_kind_of Deas::ServerError, e
      assert_equal "server `root` not set but required", e.message
    end

    should "provide a handler proxy not found exception" do
      assert Deas::HandlerProxyNotFound
      assert_kind_of Deas::Error, Deas::HandlerProxyNotFound.new
    end

  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
deas-0.37.1 test/unit/exceptions_tests.rb
deas-0.37.0 test/unit/exceptions_tests.rb
deas-0.36.0 test/unit/exceptions_tests.rb
deas-0.35.0 test/unit/exceptions_tests.rb
deas-0.34.0 test/unit/exceptions_tests.rb
deas-0.33.0 test/unit/exceptions_tests.rb
deas-0.32.0 test/unit/exceptions_tests.rb