diff options
Diffstat (limited to 'spec/ruby/core/string/unpack')
-rw-r--r-- | spec/ruby/core/string/unpack/a_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/string/unpack/b_spec.rb | 4 | ||||
-rw-r--r-- | spec/ruby/core/string/unpack/u_spec.rb | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/spec/ruby/core/string/unpack/a_spec.rb b/spec/ruby/core/string/unpack/a_spec.rb index 2d83b4c824..4002ece697 100644 --- a/spec/ruby/core/string/unpack/a_spec.rb +++ b/spec/ruby/core/string/unpack/a_spec.rb @@ -31,7 +31,7 @@ describe "String#unpack with format 'A'" do end it "decodes into raw (ascii) string values" do - str = "str".force_encoding('UTF-8').unpack("A*")[0] + str = "str".dup.force_encoding('UTF-8').unpack("A*")[0] str.encoding.should == Encoding::BINARY end diff --git a/spec/ruby/core/string/unpack/b_spec.rb b/spec/ruby/core/string/unpack/b_spec.rb index 5c53eff721..23d93a8aea 100644 --- a/spec/ruby/core/string/unpack/b_spec.rb +++ b/spec/ruby/core/string/unpack/b_spec.rb @@ -107,7 +107,7 @@ describe "String#unpack with format 'B'" do end it "decodes into US-ASCII string values" do - str = "s".force_encoding('UTF-8').unpack("B*")[0] + str = "s".dup.force_encoding('UTF-8').unpack("B*")[0] str.encoding.name.should == 'US-ASCII' end end @@ -215,7 +215,7 @@ describe "String#unpack with format 'b'" do end it "decodes into US-ASCII string values" do - str = "s".force_encoding('UTF-8').unpack("b*")[0] + str = "s".dup.force_encoding('UTF-8').unpack("b*")[0] str.encoding.name.should == 'US-ASCII' end end diff --git a/spec/ruby/core/string/unpack/u_spec.rb b/spec/ruby/core/string/unpack/u_spec.rb index 7845e6d5f2..456abee784 100644 --- a/spec/ruby/core/string/unpack/u_spec.rb +++ b/spec/ruby/core/string/unpack/u_spec.rb @@ -33,7 +33,7 @@ describe "String#unpack with format 'u'" do str = "".unpack("u")[0] str.encoding.should == Encoding::BINARY - str = "1".force_encoding('UTF-8').unpack("u")[0] + str = "1".dup.force_encoding('UTF-8').unpack("u")[0] str.encoding.should == Encoding::BINARY end |