32 lines
723 B
Ruby
32 lines
723 B
Ruby
|
|
require 'spec_helper'
|
||
|
|
|
||
|
|
describe Profanity do
|
||
|
|
|
||
|
|
describe "profanity_filter" do
|
||
|
|
|
||
|
|
it "can handle a nil input" do
|
||
|
|
Profanity.is_profane?(nil).should be_false
|
||
|
|
end
|
||
|
|
|
||
|
|
it "can handle a blank input" do
|
||
|
|
Profanity.is_profane?('').should be_false
|
||
|
|
end
|
||
|
|
|
||
|
|
it "can handle a clean input" do
|
||
|
|
Profanity.is_profane?('you are a clean input').should be_false
|
||
|
|
end
|
||
|
|
|
||
|
|
it "can handle a profane input" do
|
||
|
|
Profanity.is_profane?('fuck you!').should be_true
|
||
|
|
end
|
||
|
|
|
||
|
|
it "is not fooled by punctuation" do
|
||
|
|
Profanity.is_profane?('fuck-you!').should be_true
|
||
|
|
Profanity.is_profane?('???$$fuck-you!').should be_true
|
||
|
|
Profanity.is_profane?('--!fuck-you!').should be_true
|
||
|
|
end
|
||
|
|
end
|
||
|
|
|
||
|
|
end
|
||
|
|
|