Sha256: 3b713ca46841128b63fd9af5cbe19a691d53e3100fd40508ef4d04ae89f362f6
Contents?: true
Size: 1.5 KB
Versions: 12
Compression:
Stored size: 1.5 KB
Contents
require 'assert' require 'deas/route_proxy' require 'deas/exceptions' require 'deas/handler_proxy' require 'test/support/empty_view_handler' class Deas::RouteProxy class UnitTests < Assert::Context desc "Deas::RouteProxy" setup do @proxy = Deas::RouteProxy.new('EmptyViewHandler') end subject{ @proxy } should "be a HandlerProxy" do assert_kind_of Deas::HandlerProxy, subject end should "complain if given a nil handler class name" do assert_raises(Deas::NoHandlerClassError) do Deas::RouteProxy.new(nil) end end should "apply no view handler ns if none given" do assert_equal 'EmptyViewHandler', subject.handler_class_name end should "apply an optional view handler ns if it is given" do proxy = Deas::RouteProxy.new('NsTest', 'MyStuff') assert_equal 'MyStuff::NsTest', proxy.handler_class_name end should "ignore the ns when given a class name with leading colons" do proxy = Deas::RouteProxy.new('::NoNsTest', 'MyStuff') assert_equal '::NoNsTest', proxy.handler_class_name end should "set its handler class on `validate!`" do assert_nil subject.handler_class assert_nothing_raised{ subject.validate! } assert_equal EmptyViewHandler, subject.handler_class end should "complain if there is no handler class with the given name" do assert_raises(Deas::NoHandlerClassError) do Deas::RouteProxy.new('SomethingNotDefined').validate! end end end end
Version data entries
12 entries across 12 versions & 1 rubygems