mirror of
https://github.com/kemko/liquid.git
synced 2026-01-01 15:55:40 +03:00
Fix a timezone test failure.
This commit is contained in:
@@ -157,8 +157,10 @@ class StandardFiltersTest < Test::Unit::TestCase
|
||||
|
||||
assert_equal nil, @filters.date(nil, "%B")
|
||||
|
||||
assert_equal "07/05/2006", @filters.date(1152098955, "%m/%d/%Y")
|
||||
assert_equal "07/05/2006", @filters.date("1152098955", "%m/%d/%Y")
|
||||
with_timezone("UTC") do
|
||||
assert_equal "07/05/2006", @filters.date(1152098955, "%m/%d/%Y")
|
||||
assert_equal "07/05/2006", @filters.date("1152098955", "%m/%d/%Y")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -248,4 +250,14 @@ class StandardFiltersTest < Test::Unit::TestCase
|
||||
def test_cannot_access_private_methods
|
||||
assert_template_result('a',"{{ 'a' | to_number }}")
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def with_timezone(tz)
|
||||
old_tz = ENV['TZ']
|
||||
ENV['TZ'] = tz
|
||||
yield
|
||||
ensure
|
||||
ENV['TZ'] = old_tz
|
||||
end
|
||||
end # StandardFiltersTest
|
||||
|
||||
Reference in New Issue
Block a user