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/start_with_spec.rb | |
parent | d51b4e34fbdbe1a845aa2251b1fa3304de809b32 (diff) | |
download | ruby-070cbe22b70ec2bec36c7cfc84b726510afa306f.tar.gz |
Update to ruby/spec@34e6246
Diffstat (limited to 'spec/ruby/core/string/start_with_spec.rb')
-rw-r--r-- | spec/ruby/core/string/start_with_spec.rb | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/spec/ruby/core/string/start_with_spec.rb b/spec/ruby/core/string/start_with_spec.rb index f66ec55266..1000db180c 100644 --- a/spec/ruby/core/string/start_with_spec.rb +++ b/spec/ruby/core/string/start_with_spec.rb @@ -5,29 +5,29 @@ require_relative 'fixtures/classes' describe "String#start_with?" do it "returns true only if beginning match" do s = "hello" - s.start_with?('h').should be_true - s.start_with?('hel').should be_true - s.start_with?('el').should be_false + s.should.start_with?('h') + s.should.start_with?('hel') + s.should_not.start_with?('el') end it "returns true only if any beginning match" do - "hello".start_with?('x', 'y', 'he', 'z').should be_true + "hello".should.start_with?('x', 'y', 'he', 'z') end it "returns true if the search string is empty" do - "hello".start_with?("").should be_true - "".start_with?("").should be_true + "hello".should.start_with?("") + "".should.start_with?("") end it "converts its argument using :to_str" do s = "hello" find = mock('h') find.should_receive(:to_str).and_return("h") - s.start_with?(find).should be_true + s.should.start_with?(find) end it "ignores arguments not convertible to string" do - "hello".start_with?().should be_false + "hello".should_not.start_with?() -> { "hello".start_with?(1) }.should raise_error(TypeError) -> { "hello".start_with?(["h"]) }.should raise_error(TypeError) -> { "hello".start_with?(1, nil, "h") }.should raise_error(TypeError) @@ -36,29 +36,29 @@ describe "String#start_with?" do it "uses only the needed arguments" do find = mock('h') find.should_not_receive(:to_str) - "hello".start_with?("h",find).should be_true + "hello".should.start_with?("h",find) end it "works for multibyte strings" do - "céréale".start_with?("cér").should be_true + "céréale".should.start_with?("cér") end ruby_version_is "2.5" do it "supports regexps" do regexp = /[h1]/ - "hello".start_with?(regexp).should be_true - "1337".start_with?(regexp).should be_true - "foxes are 1337".start_with?(regexp).should be_false - "chunky\n12bacon".start_with?(/12/).should be_false + "hello".should.start_with?(regexp) + "1337".should.start_with?(regexp) + "foxes are 1337".should_not.start_with?(regexp) + "chunky\n12bacon".should_not.start_with?(/12/) end it "supports regexps with ^ and $ modifiers" do regexp1 = /^\d{2}/ regexp2 = /\d{2}$/ - "12test".start_with?(regexp1).should be_true - "test12".start_with?(regexp1).should be_false - "12test".start_with?(regexp2).should be_false - "test12".start_with?(regexp2).should be_false + "12test".should.start_with?(regexp1) + "test12".should_not.start_with?(regexp1) + "12test".should_not.start_with?(regexp2) + "test12".should_not.start_with?(regexp2) end it "sets Regexp.last_match if it returns true" do |