aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/mime
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2013-12-07 15:00:35 -0800
committerDavid Heinemeier Hansson <david@loudthinking.com>2013-12-07 15:00:35 -0800
commita16fa9abfd0b34026b04f4ceeb0b75e63609a74a (patch)
tree0f308828e18d5f0280530551cd6bc72ae2cbd647 /actionpack/test/controller/mime
parent76dae289edf33d4b3fc937ecd9d2c77b294d8074 (diff)
downloadrails-a16fa9abfd0b34026b04f4ceeb0b75e63609a74a.tar.gz
rails-a16fa9abfd0b34026b04f4ceeb0b75e63609a74a.tar.bz2
rails-a16fa9abfd0b34026b04f4ceeb0b75e63609a74a.zip
Allow code execution in case no variant has been set with variant.none
Diffstat (limited to 'actionpack/test/controller/mime')
-rw-r--r--actionpack/test/controller/mime/respond_to_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/actionpack/test/controller/mime/respond_to_test.rb b/actionpack/test/controller/mime/respond_to_test.rb
index 2b6c8739af..cd93043360 100644
--- a/actionpack/test/controller/mime/respond_to_test.rb
+++ b/actionpack/test/controller/mime/respond_to_test.rb
@@ -166,6 +166,15 @@ class RespondToController < ActionController::Base
end
end
+ def variant_plus_none_for_format
+ respond_to do |format|
+ format.html do |variant|
+ variant.phone { render text: "phone" }
+ variant.none { render text: "none" }
+ end
+ end
+ end
+
protected
def set_layout
case action_name
@@ -544,4 +553,11 @@ class RespondToControllerTest < ActionController::TestCase
assert_equal "text/html", @response.content_type
assert_equal "tablet", @response.body
end
+
+
+ def test_no_variant_in_variant_setup
+ get :variant_plus_none_for_format
+ assert_equal "text/html", @response.content_type
+ assert_equal "none", @response.body
+ end
end