summaryrefslogtreecommitdiff
path: root/spec/ruby/core/string/center_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/string/center_spec.rb')
-rw-r--r--spec/ruby/core/string/center_spec.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/spec/ruby/core/string/center_spec.rb b/spec/ruby/core/string/center_spec.rb
index a59dd2a91b..1667b59327 100644
--- a/spec/ruby/core/string/center_spec.rb
+++ b/spec/ruby/core/string/center_spec.rb
@@ -92,7 +92,7 @@ describe "String#center with length, padding" do
describe "with width" do
it "returns a String in the same encoding as the original" do
- str = "abc".force_encoding Encoding::IBM437
+ str = "abc".dup.force_encoding Encoding::IBM437
result = str.center 6
result.should == " abc "
result.encoding.should equal(Encoding::IBM437)
@@ -101,7 +101,7 @@ describe "String#center with length, padding" do
describe "with width, pattern" do
it "returns a String in the compatible encoding" do
- str = "abc".force_encoding Encoding::IBM437
+ str = "abc".dup.force_encoding Encoding::IBM437
result = str.center 6, "あ"
result.should == "あabcああ"
result.encoding.should equal(Encoding::UTF_8)