diff options
Diffstat (limited to 'spec/ruby/core/string/lstrip_spec.rb')
| -rw-r--r-- | spec/ruby/core/string/lstrip_spec.rb | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/spec/ruby/core/string/lstrip_spec.rb b/spec/ruby/core/string/lstrip_spec.rb index 85685deb0a..5896f8d7da 100644 --- a/spec/ruby/core/string/lstrip_spec.rb +++ b/spec/ruby/core/string/lstrip_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: false require_relative '../../spec_helper' require_relative 'fixtures/classes' require_relative 'shared/strip' @@ -6,11 +7,11 @@ describe "String#lstrip" do it_behaves_like :string_strip, :lstrip it "returns a copy of self with leading whitespace removed" do - " hello ".lstrip.should == "hello " - " hello world ".lstrip.should == "hello world " - "\n\r\t\n\v\r hello world ".lstrip.should == "hello world " - "hello".lstrip.should == "hello" - " こにちわ".lstrip.should == "こにちわ" + " hello ".lstrip.should == "hello " + " hello world ".lstrip.should == "hello world " + "\n\r\t\n\v\r hello world ".lstrip.should == "hello world " + "hello".lstrip.should == "hello" + " こにちわ".lstrip.should == "こにちわ" end it "works with lazy substrings" do @@ -21,15 +22,15 @@ describe "String#lstrip" do end it "strips leading \\0" do - "\x00hello".lstrip.should == "hello" - "\000 \000hello\000 \000".lstrip.should == "hello\000 \000" + "\x00hello".lstrip.should == "hello" + "\000 \000hello\000 \000".lstrip.should == "hello\000 \000" end end describe "String#lstrip!" do it "modifies self in place and returns self" do a = " hello " - a.lstrip!.should equal(a) + a.lstrip!.should.equal?(a) a.should == "hello " end @@ -52,22 +53,22 @@ describe "String#lstrip!" do end it "raises a FrozenError on a frozen instance that is modified" do - -> { " hello ".freeze.lstrip! }.should raise_error(FrozenError) + -> { " hello ".freeze.lstrip! }.should.raise(FrozenError) end # see [ruby-core:23657] it "raises a FrozenError on a frozen instance that would not be modified" do - -> { "hello".freeze.lstrip! }.should raise_error(FrozenError) - -> { "".freeze.lstrip! }.should raise_error(FrozenError) + -> { "hello".freeze.lstrip! }.should.raise(FrozenError) + -> { "".freeze.lstrip! }.should.raise(FrozenError) end it "raises an ArgumentError if the first non-space codepoint is invalid" do s = "\xDFabc".force_encoding(Encoding::UTF_8) - s.valid_encoding?.should be_false - -> { s.lstrip! }.should raise_error(ArgumentError) + s.valid_encoding?.should == false + -> { s.lstrip! }.should.raise(ArgumentError) s = " \xDFabc".force_encoding(Encoding::UTF_8) - s.valid_encoding?.should be_false - -> { s.lstrip! }.should raise_error(ArgumentError) + s.valid_encoding?.should == false + -> { s.lstrip! }.should.raise(ArgumentError) end end |
