test/unit/view_handler_tests.rb in deas-0.13.1 vs test/unit/view_handler_tests.rb in deas-0.14.0
- old
+ new
@@ -171,6 +171,47 @@
assert_equal 'test halting', runner.return_value[2]
end
end
+ class ContentTypeTests < BaseTests
+ desc "content_type"
+
+ should "should set the response content_type/charset" do
+ runner = test_runner(ContentTypeViewHandler)
+ content_type_args = runner.run
+
+ assert_equal 'text/plain', content_type_args.value
+ assert_equal({:charset => 'latin1'}, content_type_args.opts)
+ end
+
+ end
+
+ class StatusTests < BaseTests
+ desc "status"
+
+ should "should set the response status" do
+ runner = test_runner(StatusViewHandler)
+ status_args = runner.run
+
+ assert_equal 422, status_args.value
+ end
+
+ end
+
+ class HeadersTests < BaseTests
+ desc "headers"
+
+ should "should set the response status" do
+ runner = test_runner(HeadersViewHandler)
+ headers_args = runner.run
+ exp_headers = {
+ 'a-header' => 'some value',
+ 'other' => 'other'
+ }
+
+ assert_equal exp_headers, headers_args.value
+ end
+
+ end
+
end