aboutsummaryrefslogtreecommitdiffstats
path: root/spec/lib/basic_encoding_spec.rb
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2015-06-23 10:01:49 +0100
committerLouise Crow <louise.crow@gmail.com>2015-06-23 10:01:49 +0100
commitac59a76cc380af792a09e5dd82b8402dc966af42 (patch)
tree8c0640c44a11ac6f9e42fdb7fc7e6618da2ed6fe /spec/lib/basic_encoding_spec.rb
parent994a13b08be94220512961b28de8fb95c8d181a5 (diff)
parent7983e37506f3fa16211255ef802bf50735adbdb8 (diff)
Merge branch 'binary-or-utf8-attachment-bodies' into develop
Diffstat (limited to 'spec/lib/basic_encoding_spec.rb')
-rw-r--r--spec/lib/basic_encoding_spec.rb24
1 files changed, 15 insertions, 9 deletions
diff --git a/spec/lib/basic_encoding_spec.rb b/spec/lib/basic_encoding_spec.rb
index d77465ad8..6758d60a3 100644
--- a/spec/lib/basic_encoding_spec.rb
+++ b/spec/lib/basic_encoding_spec.rb
@@ -160,21 +160,24 @@ describe "convert_string_to_utf8" do
describe "when passed uninterpretable character data" do
- it "should return it as a utf8 string" do
+ it "should return it as a valid utf8 string with non-utf8 characters removed
+ and mark it as scrubbed" do
converted = convert_string_to_utf8 random_string
- converted.should == random_string
if String.method_defined?(:encode)
- converted.encoding.to_s.should == 'UTF-8'
+ converted.string.encoding.to_s.should == 'UTF-8'
+ converted.string.valid_encoding?.should == true
end
+ converted.scrubbed?.should == true
converted = convert_string_to_utf8 random_string,'UTF-8'
- converted.should == random_string
if String.method_defined?(:encode)
- converted.encoding.to_s.should == 'UTF-8'
+ converted.string.encoding.to_s.should == 'UTF-8'
+ converted.string.valid_encoding?.should == true
end
+ converted.scrubbed?.should == true
end
end
@@ -185,11 +188,13 @@ describe "convert_string_to_utf8" do
converted = convert_string_to_utf8 windows_1252_string
- converted.should == "DASH – DASH"
+ converted.string.should == "DASH – DASH"
if String.method_defined?(:encode)
- converted.encoding.to_s.should == 'UTF-8'
+ converted.string.encoding.to_s.should == 'UTF-8'
end
+ converted.scrubbed?.should == false
+
end
end
@@ -200,11 +205,12 @@ describe "convert_string_to_utf8" do
converted = convert_string_to_utf8 gb_18030_spam_string
- converted.should start_with("贵公司负责人")
+ converted.string.should start_with("贵公司负责人")
if String.method_defined?(:encode)
- converted.encoding.to_s.should == 'UTF-8'
+ converted.string.encoding.to_s.should == 'UTF-8'
end
+ converted.scrubbed?.should == false
end
end