Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding tests for the dictionary update provided by Scott Stewart
- Loading branch information
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |