test/unit/view_handler_tests.rb in deas-0.29.0 vs test/unit/view_handler_tests.rb in deas-0.30.0

- old
+ new

@@ -1,9 +1,10 @@ require 'assert' require 'deas/view_handler' require 'deas/test_helpers' +require 'deas/template_source' require 'test/support/view_handlers' module Deas::ViewHandler class UnitTests < Assert::Context @@ -71,23 +72,37 @@ assert_raises(NotImplementedError){ test_runner(EmptyViewHandler).run } end should "render templates" do render_args = test_runner(RenderViewHandler).run - assert_equal "my_template", render_args.template_name - assert_equal({ :some => :option }, render_args.options) + assert_equal "my_template", render_args.template_name + assert_equal({:some => 'local'}, render_args.locals) end + should "render templates on a given source" do + render_args = test_runner(SourceRenderViewHandler).run + assert_kind_of Deas::TemplateSource, render_args.source + assert_equal "my_template", render_args.template_name + assert_equal({:some => 'local'}, render_args.locals) + end + should "render partial templates" do partial_args = test_runner(PartialViewHandler).run - assert_equal "my_partial", partial_args.template_name - assert_equal({:some => 'locals'}, partial_args.locals) + assert_equal "my_partial", partial_args.template_name + assert_equal({:some => 'local'}, partial_args.locals) end + should "render partial templates on a given source" do + partial_args = test_runner(SourcePartialViewHandler).run + assert_kind_of Deas::TemplateSource, partial_args.source + assert_equal "my_partial", partial_args.template_name + assert_equal({:some => 'local'}, partial_args.locals) + end + should "send files" do send_file_args = test_runner(SendFileViewHandler).run - assert_equal "my_file.txt", send_file_args.file_path - assert_equal({ :some => :option }, send_file_args.options) + assert_equal "my_file.txt", send_file_args.file_path + assert_equal({:some => :option}, send_file_args.options) end end class CallbackTests < UnitTests