diff options
author | Louise Crow <louise.crow@gmail.com> | 2015-06-04 17:56:44 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2015-06-22 17:43:09 +0100 |
commit | 910acfa8ae939f363a872123eb47a86e64a192c3 (patch) | |
tree | c0e7e0283cc191be7905ac1c5b5f58f4074842c4 /spec/lib | |
parent | 3efe2f333a9b143e88556c0aeedb534090eb41d3 (diff) |
Use ASCII-8BIT for replacement patterns when handling binary data.
Also be explicit about using UTF-8 when handling text data.
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/alaveteli_text_masker_spec.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/spec/lib/alaveteli_text_masker_spec.rb b/spec/lib/alaveteli_text_masker_spec.rb index f2d52c1cc..f8c22a849 100644 --- a/spec/lib/alaveteli_text_masker_spec.rb +++ b/spec/lib/alaveteli_text_masker_spec.rb @@ -31,10 +31,13 @@ describe AlaveteliTextMasker do data.should == "There was a xxxxx called xxxxxxx, he wished that he was xxxx." end - it 'should handle multibyte characters correctly' do + it 'should handle multibyte characters in binary file types as binary data' do data = 'á mouse' + if String.method_defined?(:encode) + data = data.force_encoding("ASCII-8BIT") + end @regex_censor_rule.text = 'á' - apply_masks!(data, "application/octet-stream", :censor_rules => @censor_rules).should == 'x mouse' + apply_masks!(data, "application/octet-stream", :censor_rules => @censor_rules).should == 'xx mouse' end it "should apply censor rules to HTML files" do |