Skip to content

Commit

Permalink
Adding tests for the dictionary update provided by Scott Stewart
Browse files Browse the repository at this point in the history
  • Loading branch information
adambair committed Jun 11, 2008
1 parent f27bec8 commit c418540
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/dictionary_test.rb
@@ -0,0 +1,23 @@
require 'test/unit'
require 'rubygems'
require 'yaml'
require 'activerecord'

require File.dirname(__FILE__) + '/../lib/profanity_filter'

module DictionaryHelper
def assert_replacement(word, replacement)
assert_equal '@#$%', ProfanityFilter::Base.clean(word)
assert_equal replacement, ProfanityFilter::Base.clean(word, 'dictionary')
end
end

class DictionaryTest < Test::Unit::TestCase
include DictionaryHelper

def test_filter_should_replace_the_word_pussy_and_related
assert_replacement('pussy', 'p*ssy')
assert_replacement('pusys', 'p*ssys')
assert_replacement('pussies', 'p*ss**s')
end
end

0 comments on commit c418540

Please sign in to comment.