Sha256: a4268e623ae224d9a84cc6e434b21272980fc2c9d5be215d8903c5d768e190e7

Contents?: true

Size: 1.1 KB

Versions: 13

Compression:

Stored size: 1.1 KB

Contents

require 'assert'
require 'test/support/view_handlers'
require 'deas/route_proxy'
require 'deas/route'

class Deas::Route

  class BaseTests < Assert::Context
    desc "Deas::Route"
    setup do
      @handler_proxy = Deas::RouteProxy.new('TestViewHandler')
      @route = Deas::Route.new(:get, '/test', @handler_proxy)
    end
    subject{ @route }

    should have_readers :method, :path, :handler_proxy, :handler_class
    should have_imeths :validate!, :run

    should "know its method and path and handler_proxy" do
      assert_equal :get, subject.method
      assert_equal '/test', subject.path
      assert_equal @handler_proxy, subject.handler_proxy
    end

    should "set its handler class on `validate!`" do
      assert_nil subject.handler_class

      assert_nothing_raised{ subject.validate! }
      assert_equal TestViewHandler, subject.handler_class
    end

    should "complain given an invalid handler class" do
      proxy = Deas::RouteProxy.new('SomethingNotDefined')
      assert_raises(Deas::NoHandlerClassError) do
        Deas::Route.new(:get, '/test', proxy).validate!
      end
    end

  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
deas-0.24.0 test/unit/route_tests.rb
deas-0.23.4 test/unit/route_tests.rb
deas-0.23.3 test/unit/route_tests.rb
deas-0.23.2 test/unit/route_tests.rb
deas-0.23.1 test/unit/route_tests.rb
deas-0.23.0 test/unit/route_tests.rb
deas-0.22.1 test/unit/route_tests.rb
deas-0.22.0 test/unit/route_tests.rb
deas-0.21.0 test/unit/route_tests.rb
deas-0.20.0 test/unit/route_tests.rb
deas-0.19.0 test/unit/route_tests.rb
deas-0.18.0 test/unit/route_tests.rb
deas-0.17.1 test/unit/route_tests.rb