test/unit/runner_tests.rb in deas-0.26.0 vs test/unit/runner_tests.rb in deas-0.27.0

- old
+ new

@@ -1,46 +1,60 @@ require 'assert' require 'deas/runner' +require 'deas/router' require 'test/support/view_handlers' class Deas::Runner class UnitTests < Assert::Context desc "Deas::Runner" setup do - @runner = Deas::Runner.new(TestViewHandler) + @runner_class = Deas::Runner end + subject{ @runner_class } + + end + + class InitTests < UnitTests + desc "when init" + setup do + @runner = @runner_class.new(EmptyViewHandler) + end subject{ @runner } should have_readers :handler_class, :handler should have_readers :request, :response, :params should have_readers :logger, :router, :session should have_imeths :halt, :redirect, :content_type, :status, :headers - should have_imeths :render, :partial, :send_file + should have_imeths :render, :send_file should "know its handler and handler class" do - assert_equal TestViewHandler, subject.handler_class + assert_equal EmptyViewHandler, subject.handler_class assert_instance_of subject.handler_class, subject.handler end - should "not set any settings" do + should "default its settings" do assert_nil subject.request assert_nil subject.response - assert_nil subject.params - assert_nil subject.logger - assert_nil subject.router + assert_kind_of ::Hash, subject.params + assert_kind_of Deas::NullLogger, subject.logger + assert_kind_of Deas::Router, subject.router assert_nil subject.session end + should "default its params" do + runner = @runner_class.new(TestRunnerViewHandler) + assert_equal ::Hash.new, runner.params + end + should "not implement any actions" do assert_raises(NotImplementedError){ subject.halt } assert_raises(NotImplementedError){ subject.redirect } assert_raises(NotImplementedError){ subject.content_type } assert_raises(NotImplementedError){ subject.status } assert_raises(NotImplementedError){ subject.headers } assert_raises(NotImplementedError){ subject.render } - assert_raises(NotImplementedError){ subject.partial } assert_raises(NotImplementedError){ subject.send_file } end end