summaryrefslogtreecommitdiff
path: root/spec/ruby/shared/string/end_with.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/shared/string/end_with.rb')
-rw-r--r--spec/ruby/shared/string/end_with.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/spec/ruby/shared/string/end_with.rb b/spec/ruby/shared/string/end_with.rb
index 0e4c1386e8..8eb9693395 100644
--- a/spec/ruby/shared/string/end_with.rb
+++ b/spec/ruby/shared/string/end_with.rb
@@ -30,9 +30,9 @@ describe :end_with, shared: true do
it "ignores arguments not convertible to string" do
"hello".send(@method).should_not.end_with?()
- -> { "hello".send(@method).end_with?(1) }.should raise_error(TypeError)
- -> { "hello".send(@method).end_with?(["o"]) }.should raise_error(TypeError)
- -> { "hello".send(@method).end_with?(1, nil, "o") }.should raise_error(TypeError)
+ -> { "hello".send(@method).end_with?(1) }.should.raise(TypeError)
+ -> { "hello".send(@method).end_with?(["o"]) }.should.raise(TypeError)
+ -> { "hello".send(@method).end_with?(1, nil, "o") }.should.raise(TypeError)
end
it "uses only the needed arguments" do
@@ -49,13 +49,13 @@ describe :end_with, shared: true do
pat = "ア".encode Encoding::EUC_JP
-> do
"あれ".send(@method).end_with?(pat)
- end.should raise_error(Encoding::CompatibilityError)
+ end.should.raise(Encoding::CompatibilityError)
end
it "checks that we are starting to match at the head of a character" do
"\xC3\xA9".send(@method).should_not.end_with?("\xA9")
"\xe3\x81\x82".send(@method).should_not.end_with?("\x82")
- "ab".force_encoding("UTF-16BE").send(@method).should_not.end_with?(
- "b".force_encoding("UTF-16BE"))
+ "\xd8\x00\xdc\x00".dup.force_encoding("UTF-16BE").send(@method).should_not.end_with?(
+ "\xdc\x00".dup.force_encoding("UTF-16BE"))
end
end