Permalink
Browse files

Use `silence_warnings` on `StaticTests`

When 7e50492 was merged setting `Encoding.default_internal` and
`Encoding.default_external` would throw a warning when the ActionPack
tests were run.

Example warning: `actionpack/test/dispatch/static_test.rb:12: warning:
setting Encoding.default_external`

This patch silences the warnings as other similar tests do for setting
default_internal and default_external.
  • Loading branch information...
eileencodes authored and matthewd committed Apr 14, 2015
1 parent f5ca9de commit afa6ef55011e2d4b7d7197f283811581cd814c6c
Showing with 12 additions and 6 deletions.
  1. +12 −6 actionpack/test/dispatch/static_test.rb
@@ -5,13 +5,17 @@
module StaticTests
def setup
- @default_internal_encoding = Encoding.default_internal
- @default_external_encoding = Encoding.default_external
+ silence_warnings do
+ @default_internal_encoding = Encoding.default_internal
+ @default_external_encoding = Encoding.default_external
+ end
end
def teardown
- Encoding.default_internal = @default_internal_encoding
- Encoding.default_external = @default_external_encoding
+ silence_warnings do
+ Encoding.default_internal = @default_internal_encoding
+ Encoding.default_external = @default_external_encoding
+ end
end
def test_serves_dynamic_content
@@ -27,8 +31,10 @@ def test_handles_urls_with_ascii_8bit
end
def test_handles_urls_with_ascii_8bit_on_win_31j
- Encoding.default_internal = "Windows-31J"
- Encoding.default_external = "Windows-31J"
+ silence_warnings do
+ Encoding.default_internal = "Windows-31J"
+ Encoding.default_external = "Windows-31J"
+ end
assert_equal "Hello, World!", get("/doorkeeper%E3E4".force_encoding('ASCII-8BIT')).body
end

0 comments on commit afa6ef5

Please sign in to comment.