blob: 44087c5a6f601611b033d761052be5a9a00bb6f6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe CensorRule, "substituting things" do
before do
@censor_rule = CensorRule.new
@censor_rule.text = "goodbye"
@censor_rule.replacement = "hello"
end
it 'should do basic text substitution' do
body = "I don't know why you say goodbye"
@censor_rule.apply_to_text!(body)
body.should == "I don't know why you say hello"
end
it 'should keep size same for binary substitution' do
body = "I don't know why you say goodbye"
orig_body = body.dup
@censor_rule.apply_to_binary!(body)
body.size.should == orig_body.size
body.should == "I don't know why you say xxxxxxx"
body.should_not == orig_body # be sure duplicated as expected
end
end
|