mirror of
https://github.com/kemko/liquid.git
synced 2026-01-01 15:55:40 +03:00
Ruby 1.9+ uses Minitest as the backend for Test::Unit. As of Minitest 5, the shim has broken some compatibility with Test::Unit::TestCase in some scenarios. Adjusts the test suite to support Minitest 5's syntax. Minitest versions 4 and below do not support the newer Minitest::Test class that arrived in version 5. For that case, use the MiniTest::Unit::TestCase class as a fallback Conflicts: test/integration/tags/for_tag_test.rb test/test_helper.rb
34 lines
725 B
Ruby
34 lines
725 B
Ruby
require 'test_helper'
|
|
|
|
class ContextTest < Minitest::Test
|
|
include Liquid
|
|
|
|
def test_override_global_filter
|
|
global = Module.new do
|
|
def notice(output)
|
|
"Global #{output}"
|
|
end
|
|
end
|
|
|
|
local = Module.new do
|
|
def notice(output)
|
|
"Local #{output}"
|
|
end
|
|
end
|
|
|
|
Template.register_filter(global)
|
|
assert_equal 'Global test', Template.parse("{{'test' | notice }}").render!
|
|
assert_equal 'Local test', Template.parse("{{'test' | notice }}").render!({}, :filters => [local])
|
|
end
|
|
|
|
def test_has_key_will_not_add_an_error_for_missing_keys
|
|
Template.error_mode = :strict
|
|
|
|
context = Context.new
|
|
|
|
context.has_key?('unknown')
|
|
|
|
assert_empty context.errors
|
|
end
|
|
end
|