Sha256: f675e5d1e6550c0971dac214c302e38e26f3cf7cdaf0db7def25da4b3de15fc9

Contents?: true

Size: 826 Bytes

Versions: 5

Compression:

Stored size: 826 Bytes

Contents

require 'helper'

class Toadhopper::TestFiltering < Test::Unit::TestCase
  def test_filtering
    assert_not_filtered "safe", "sensitive"
    assert_not_filtered "safe", /sensitive/
    assert_filtered "sensitive", "sensitive"
    assert_filtered "sensitive", /sensitive/
    assert_filtered "sensitive", /sit/
  end

  def assert_not_filtered(key, filter)
    assert_false filtered_document(key, "value", filter).include?(Toadhopper::FILTER_REPLACEMENT)
  end
  
  def assert_filtered(key, filter)
    assert_false filtered_document(key, "value", filter).include?("value")
  end

  def filtered_document(key, value, filter)
    toadhopper.filters = filter
    hash = {"nested" => {key => value}, key => value}
    toadhopper.__send__(:document_for, error, {:params => hash, :session => hash, :environment => hash})
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
toadhopper-1.2 test/test_filtering.rb
toadhopper-1.1 test/test_filtering.rb
toadhopper-1.0.6 test/test_filtering.rb
toadhopper-1.0.4 test/test_filtering.rb
toadhopper-1.0.3 test/test_filtering.rb