mirror of
https://github.com/kemko/liquid.git
synced 2026-01-05 09:45:40 +03:00
- Organized the files - Cleaned up some of the white spacing issues - A lot can still be done to make the tests more readable to the new developers
42 lines
949 B
Ruby
42 lines
949 B
Ruby
require 'test_helper'
|
|
|
|
module SecurityFilter
|
|
def add_one(input)
|
|
"#{input} + 1"
|
|
end
|
|
end
|
|
|
|
class SecurityTest < Test::Unit::TestCase
|
|
include Liquid
|
|
|
|
def test_no_instance_eval
|
|
text = %( {{ '1+1' | instance_eval }} )
|
|
expected = %| 1+1 |
|
|
|
|
assert_equal expected, Template.parse(text).render(@assigns)
|
|
end
|
|
|
|
def test_no_existing_instance_eval
|
|
text = %( {{ '1+1' | __instance_eval__ }} )
|
|
expected = %| 1+1 |
|
|
|
|
assert_equal expected, Template.parse(text).render(@assigns)
|
|
end
|
|
|
|
|
|
def test_no_instance_eval_after_mixing_in_new_filter
|
|
text = %( {{ '1+1' | instance_eval }} )
|
|
expected = %| 1+1 |
|
|
|
|
assert_equal expected, Template.parse(text).render(@assigns)
|
|
end
|
|
|
|
|
|
def test_no_instance_eval_later_in_chain
|
|
text = %( {{ '1+1' | add_one | instance_eval }} )
|
|
expected = %| 1+1 + 1 |
|
|
|
|
assert_equal expected, Template.parse(text).render(@assigns, :filters => SecurityFilter)
|
|
end
|
|
end # SecurityTest
|