diff options
author | Benoit Daloze <eregontp@gmail.com> | 2019-09-29 19:13:37 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2019-09-29 19:13:37 +0200 |
commit | 070cbe22b70ec2bec36c7cfc84b726510afa306f (patch) | |
tree | 56cee87834c85bd9f358ebee51bab4893fb9952f /spec/ruby/core/string/end_with_spec.rb | |
parent | d51b4e34fbdbe1a845aa2251b1fa3304de809b32 (diff) | |
download | ruby-070cbe22b70ec2bec36c7cfc84b726510afa306f.tar.gz |
Update to ruby/spec@34e6246
Diffstat (limited to 'spec/ruby/core/string/end_with_spec.rb')
-rw-r--r-- | spec/ruby/core/string/end_with_spec.rb | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/spec/ruby/core/string/end_with_spec.rb b/spec/ruby/core/string/end_with_spec.rb index b7a04fdefe..9ced0ca3d2 100644 --- a/spec/ruby/core/string/end_with_spec.rb +++ b/spec/ruby/core/string/end_with_spec.rb @@ -5,33 +5,33 @@ require_relative 'fixtures/classes' describe "String#end_with?" do it "returns true only if ends match" do s = "hello" - s.end_with?('o').should be_true - s.end_with?('llo').should be_true + s.should.end_with?('o') + s.should.end_with?('llo') end it 'returns false if the end does not match' do s = 'hello' - s.end_with?('ll').should be_false + s.should_not.end_with?('ll') end it "returns true if the search string is empty" do - "hello".end_with?("").should be_true - "".end_with?("").should be_true + "hello".should.end_with?("") + "".should.end_with?("") end it "returns true only if any ending match" do - "hello".end_with?('x', 'y', 'llo', 'z').should be_true + "hello".should.end_with?('x', 'y', 'llo', 'z') end it "converts its argument using :to_str" do s = "hello" find = mock('o') find.should_receive(:to_str).and_return("o") - s.end_with?(find).should be_true + s.should.end_with?(find) end it "ignores arguments not convertible to string" do - "hello".end_with?().should be_false + "hello".should_not.end_with?() -> { "hello".end_with?(1) }.should raise_error(TypeError) -> { "hello".end_with?(["o"]) }.should raise_error(TypeError) -> { "hello".end_with?(1, nil, "o") }.should raise_error(TypeError) @@ -40,11 +40,11 @@ describe "String#end_with?" do it "uses only the needed arguments" do find = mock('h') find.should_not_receive(:to_str) - "hello".end_with?("o",find).should be_true + "hello".should.end_with?("o",find) end it "works for multibyte strings" do - "céréale".end_with?("réale").should be_true + "céréale".should.end_with?("réale") end it "raises an Encoding::CompatibilityError if the encodings are incompatible" do @@ -53,5 +53,4 @@ describe "String#end_with?" do "あれ".end_with?(pat) end.should raise_error(Encoding::CompatibilityError) end - end |