Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fu-fu now has a non-destructive method, and there was much rejoicing. […
…#4 state:resolved]
- Loading branch information
Showing
6 changed files
with
87 additions
and
9 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
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
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
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,51 @@ | ||
require File.dirname(__FILE__) + '/test_harness' | ||
|
||
module BasicPostHelper | ||
class Post < ActiveRecord::Base | ||
profanity_filter :title, :body | ||
end | ||
end | ||
|
||
module DictionaryPostHelper | ||
class Post < ActiveRecord::Base | ||
profanity_filter :title, :body, :method => 'dictionary' | ||
end | ||
end | ||
|
||
class BasicProfanityFilterTest < Test::Unit::TestCase | ||
include BasicPostHelper | ||
|
||
def profane_post(opts={}) | ||
Post.new({:title => 'A Fucking Title', :body => "This is some shitty post by a fucking user"}.merge(opts)) | ||
end | ||
|
||
def test_it_should_filter_specified_fields | ||
p = profane_post | ||
p.save | ||
assert_equal 'A @#$% Title', p.title | ||
assert_equal 'A @#$% Title', p.title_clean | ||
assert_equal 'A Fucking Title', p.title_original | ||
assert_equal 'This is some @#$% post by a @#$% user', p.body | ||
assert_equal 'This is some @#$% post by a @#$% user', p.body_clean | ||
assert_equal 'This is some shitty post by a fucking user', p.body_original | ||
end | ||
end | ||
|
||
class DictionaryProfanityFilterTest < Test::Unit::TestCase | ||
include DictionaryPostHelper | ||
|
||
def profane_post(opts={}) | ||
Post.new({:title => 'A Fucking Title', :body => "This is some shitty post by a fucking user"}.merge(opts)) | ||
end | ||
|
||
def test_it_should_filter_specified_fields | ||
p = profane_post | ||
p.save | ||
assert_equal 'A f*ck*ng Title', p.title | ||
assert_equal 'A f*ck*ng Title', p.title_clean | ||
assert_equal 'A Fucking Title', p.title_original | ||
assert_equal 'This is some sh*tty post by a f*ck*ng user', p.body | ||
assert_equal 'This is some sh*tty post by a f*ck*ng user', p.body_clean | ||
assert_equal 'This is some shitty post by a fucking user', p.body_original | ||
end | ||
end |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
sqlite: | ||
:adapter: sqlite | ||
:dbfile: profanity_filter.sqlite.db | ||
:dbfile: vendor/plugins/fu-fu/test/profanity_filter.sqlite.db | ||
sqlite3: | ||
:adapter: sqlite3 | ||
:dbfile: profanity_filter.sqlite3.db | ||
:dbfile: vendor/plugins/fu-fu/test/profanity_filter.sqlite3.db |
File renamed without changes.