Sha256: fb8b1bf2d8d319ecbb862166c8f5ee6374aa94f4315934a358ac0dbbd4f45687

Contents?: true

Size: 978 Bytes

Versions: 2

Compression:

Stored size: 978 Bytes

Contents

require File.dirname(__FILE__) + '/helper'

module SecurityFilter
  def add_one(input)
    "#{input} + 1"
  end
end

class SecurityTest < Test::Unit::TestCase
  include Liquor

  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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
liquor-0.1.1 test/security_test.rb
liquor-0.1.0 test/security_test.rb