spec/swearjar_spec.rb in swearjar-1.3.1 vs spec/swearjar_spec.rb in swearjar-1.4.0
- old
+ new
@@ -86,6 +86,15 @@
end
it "doesn't substitute simple words when they occur later as substrings" do
expect(Swearjar.default.censor("anus janus")).to eq("**** janus")
end
+
+ it "detects profane phrases with spaces" do
+ expect(Swearjar.default.censor("nut sack nutsac nut sac ")).to eq("*** **** ****** *** *** ")
+ expect(Swearjar.default.censor("junglebunnies jungle bunnyabc")).to eq("************* ****** ********")
+ end
+
+ it "allows a custom censor mask" do
+ expect(Swearjar.default.censor("a fucked to hell nut sack", "X")).to eq("a XXXXXX to XXXX XXX XXXX")
+ end
end