summaryrefslogtreecommitdiff
path: root/spec/ruby/core/string/unpack/u_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/string/unpack/u_spec.rb')
-rw-r--r--spec/ruby/core/string/unpack/u_spec.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/spec/ruby/core/string/unpack/u_spec.rb b/spec/ruby/core/string/unpack/u_spec.rb
index 7845e6d5f2..720c1b8583 100644
--- a/spec/ruby/core/string/unpack/u_spec.rb
+++ b/spec/ruby/core/string/unpack/u_spec.rb
@@ -1,4 +1,4 @@
-# -*- encoding: binary -*-
+# encoding: binary
require_relative '../../../spec_helper'
require_relative '../fixtures/classes'
require_relative 'shared/basic'
@@ -12,11 +12,11 @@ describe "String#unpack with format 'U'" do
it_behaves_like :string_unpack_taint, 'U'
it "raises ArgumentError on a malformed byte sequence" do
- -> { "\xE3".unpack('U') }.should raise_error(ArgumentError)
+ -> { "\xE3".unpack('U') }.should.raise(ArgumentError)
end
it "raises ArgumentError on a malformed byte sequence and doesn't continue when used with the * modifier" do
- -> { "\xE3".unpack('U*') }.should raise_error(ArgumentError)
+ -> { "\xE3".unpack('U*') }.should.raise(ArgumentError)
end
end
@@ -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