summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2016-08-17 16:11:46 +0200
committerAzul <azul@riseup.net>2016-08-17 16:12:17 +0200
commit20bb76848b852bba9ab3c99b1c2a68464585bd56 (patch)
treebbcd028b74179ea7c76abb1ffb66a5f52acd881b /test
parent44910c0909f28791fe6725fa76301e5111ece3b4 (diff)
bugfix: send 406 if an unexpected format is asked for
It used to run the action and then trigger a 500 because the template was not found. fixes !3 .
Diffstat (limited to 'test')
-rw-r--r--test/functional/home_controller_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/functional/home_controller_test.rb b/test/functional/home_controller_test.rb
new file mode 100644
index 0000000..cafaac5
--- /dev/null
+++ b/test/functional/home_controller_test.rb
@@ -0,0 +1,16 @@
+require 'test_helper'
+
+class HomeControllerTest < ActionController::TestCase
+
+ def test_renders_okay
+ get :index
+ assert_response :success
+ end
+
+ def test_other_formats_trigger_406
+ assert_raises ActionController::UnknownFormat do
+ get :index, format: :xml
+ end
+ end
+
+end