Sha256: deeb16ecb37b80d193bc6a4a81d64452dadc7acc2fdb620a5403d88ca34f5a1c

Contents?: true

Size: 1.14 KB

Versions: 21

Compression:

Stored size: 1.14 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 that subclasses `Error`" 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 that subclasses `Error`" do
      assert Deas::ServerError
      assert_kind_of Deas::Error, Deas::ServerError.new
    end

    should "provide a server root exception that subclasses `ServerError`" 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

  end

end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
deas-0.31.0 test/unit/exceptions_tests.rb
deas-0.30.0 test/unit/exceptions_tests.rb
deas-0.29.0 test/unit/exceptions_tests.rb
deas-0.28.0 test/unit/exceptions_tests.rb
deas-0.27.0 test/unit/exceptions_tests.rb
deas-0.26.0 test/unit/exceptions_tests.rb
deas-0.25.0 test/unit/exceptions_tests.rb
deas-0.24.1 test/unit/exceptions_tests.rb
deas-0.24.0 test/unit/exceptions_tests.rb
deas-0.23.4 test/unit/exceptions_tests.rb
deas-0.23.3 test/unit/exceptions_tests.rb
deas-0.23.2 test/unit/exceptions_tests.rb
deas-0.23.1 test/unit/exceptions_tests.rb
deas-0.23.0 test/unit/exceptions_tests.rb
deas-0.22.1 test/unit/exceptions_tests.rb
deas-0.22.0 test/unit/exceptions_tests.rb
deas-0.21.0 test/unit/exceptions_tests.rb
deas-0.20.0 test/unit/exceptions_tests.rb
deas-0.19.0 test/unit/exceptions_tests.rb
deas-0.18.0 test/unit/exceptions_tests.rb