diff options
author | Eileen M. Uchitelle <eileencodes@users.noreply.github.com> | 2019-03-20 11:52:55 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-20 11:52:55 -0400 |
commit | d36991147863a95bea93506dc5411d00043790f5 (patch) | |
tree | 1236f5f1e3b2177b116a606f3b8ecfbdf21c6aee /actionview/test | |
parent | c11d115fa3c58ec6bde5e9799673cee381d22d47 (diff) | |
parent | 0756733d75cd4b9e115cc43f457c7f2731c25e1c (diff) | |
download | rails-d36991147863a95bea93506dc5411d00043790f5.tar.gz rails-d36991147863a95bea93506dc5411d00043790f5.tar.bz2 rails-d36991147863a95bea93506dc5411d00043790f5.zip |
Merge pull request #35661 from jhawthorn/lookup_context_validation
Validate types assigned to LookupContext#formats=
Diffstat (limited to 'actionview/test')
-rw-r--r-- | actionview/test/template/lookup_context_test.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/actionview/test/template/lookup_context_test.rb b/actionview/test/template/lookup_context_test.rb index 537f8ee163..3e357fe1a7 100644 --- a/actionview/test/template/lookup_context_test.rb +++ b/actionview/test/template/lookup_context_test.rb @@ -67,7 +67,7 @@ class LookupContextTest < ActiveSupport::TestCase test "handles explicitly defined */* formats fallback to :js" do @lookup_context.formats = [:js, Mime::ALL] - assert_equal [:js, *Mime::SET.symbols], @lookup_context.formats + assert_equal [:js, *Mime::SET.symbols].uniq, @lookup_context.formats end test "adds :html fallback to :js formats" do @@ -75,6 +75,14 @@ class LookupContextTest < ActiveSupport::TestCase assert_equal [:js, :html], @lookup_context.formats end + test "raises on invalid format assignment" do + ex = assert_raises ArgumentError do + @lookup_context.formats = [:html, :invalid, "also bad"] + end + + assert_equal 'Invalid formats: :invalid, "also bad"', ex.message + end + test "provides getters and setters for locale" do @lookup_context.locale = :pt assert_equal :pt, @lookup_context.locale |