From c555e28a4cf3690a95b5ed108d174f39cedd19b1 Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Mon, 18 Mar 2019 10:12:41 -0700 Subject: Ignore nil in LookupContext#formats= This also removes the mutation we were performing on the values being passed in. --- actionview/test/template/lookup_context_test.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'actionview/test') diff --git a/actionview/test/template/lookup_context_test.rb b/actionview/test/template/lookup_context_test.rb index 537f8ee163..8b61302c32 100644 --- a/actionview/test/template/lookup_context_test.rb +++ b/actionview/test/template/lookup_context_test.rb @@ -65,6 +65,11 @@ class LookupContextTest < ActiveSupport::TestCase assert_equal Mime::SET.to_a, @lookup_context.formats end + test "ignores nil format" do + @lookup_context.formats = [:html, nil, :text] + assert_equal [:html, :text], @lookup_context.formats + end + test "handles explicitly defined */* formats fallback to :js" do @lookup_context.formats = [:js, Mime::ALL] assert_equal [:js, *Mime::SET.symbols], @lookup_context.formats -- cgit v1.2.3