diff options
Diffstat (limited to 'spec/ruby/core/string/chomp_spec.rb')
| -rw-r--r-- | spec/ruby/core/string/chomp_spec.rb | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/spec/ruby/core/string/chomp_spec.rb b/spec/ruby/core/string/chomp_spec.rb index d27c84c6f6..3a8550892f 100644 --- a/spec/ruby/core/string/chomp_spec.rb +++ b/spec/ruby/core/string/chomp_spec.rb @@ -22,7 +22,7 @@ describe "String#chomp" do it "returns a copy of the String when it is not modified" do str = "abc" - str.chomp.should_not equal(str) + str.chomp.should_not.equal?(str) end it "removes one trailing newline" do @@ -47,7 +47,7 @@ describe "String#chomp" do it "returns String instances when called on a subclass" do str = StringSpecs::MyString.new("hello\n").chomp - str.should be_an_instance_of(String) + str.should.instance_of?(String) end it "removes trailing characters that match $/ when it has been assigned a value" do @@ -67,7 +67,7 @@ describe "String#chomp" do it "returns a copy of the String" do str = "abc" - str.chomp(nil).should_not equal(str) + str.chomp(nil).should_not.equal?(str) end it "returns an empty String when self is empty" do @@ -133,7 +133,7 @@ describe "String#chomp" do it "raises a TypeError if #to_str does not return a String" do arg = mock("string chomp") arg.should_receive(:to_str).and_return(1) - -> { "abc".chomp(arg) }.should raise_error(TypeError) + -> { "abc".chomp(arg) }.should.raise(TypeError) end end @@ -171,11 +171,11 @@ describe "String#chomp!" do it "modifies self" do str = "abc\n" - str.chomp!.should equal(str) + str.chomp!.should.equal?(str) end it "returns nil if self is not modified" do - "abc".chomp!.should be_nil + "abc".chomp!.should == nil end it "removes one trailing newline" do @@ -191,12 +191,12 @@ describe "String#chomp!" do end it "returns nil when self is empty" do - "".chomp!.should be_nil + "".chomp!.should == nil end it "returns subclass instances when called on a subclass" do str = StringSpecs::MyString.new("hello\n").chomp! - str.should be_an_instance_of(StringSpecs::MyString) + str.should.instance_of?(StringSpecs::MyString) end it "removes trailing characters that match $/ when it has been assigned a value" do @@ -207,11 +207,11 @@ describe "String#chomp!" do describe "when passed nil" do it "returns nil" do - "abc\r\n".chomp!(nil).should be_nil + "abc\r\n".chomp!(nil).should == nil end it "returns nil when self is empty" do - "".chomp!(nil).should be_nil + "".chomp!(nil).should == nil end end @@ -225,7 +225,7 @@ describe "String#chomp!" do end it "does not remove a final carriage return" do - "abc\r".chomp!("").should be_nil + "abc\r".chomp!("").should == nil end it "removes more than one trailing newlines" do @@ -237,7 +237,7 @@ describe "String#chomp!" do end it "returns nil when self is empty" do - "".chomp!("").should be_nil + "".chomp!("").should == nil end end @@ -255,7 +255,7 @@ describe "String#chomp!" do end it "returns nil when self is empty" do - "".chomp!("\n").should be_nil + "".chomp!("\n").should == nil end end @@ -269,7 +269,7 @@ describe "String#chomp!" do it "raises a TypeError if #to_str does not return a String" do arg = mock("string chomp") arg.should_receive(:to_str).and_return(1) - -> { "abc".chomp!(arg) }.should raise_error(TypeError) + -> { "abc".chomp!(arg) }.should.raise(TypeError) end end @@ -279,11 +279,11 @@ describe "String#chomp!" do end it "returns nil if the argument does not match the trailing characters" do - "abc".chomp!("def").should be_nil + "abc".chomp!("def").should == nil end it "returns nil when self is empty" do - "".chomp!("abc").should be_nil + "".chomp!("abc").should == nil end end @@ -291,15 +291,15 @@ describe "String#chomp!" do a = "string\n\r" a.freeze - -> { a.chomp! }.should raise_error(FrozenError) + -> { a.chomp! }.should.raise(FrozenError) end # see [ruby-core:23666] it "raises a FrozenError on a frozen instance when it would not be modified" do a = "string\n\r" a.freeze - -> { a.chomp!(nil) }.should raise_error(FrozenError) - -> { a.chomp!("x") }.should raise_error(FrozenError) + -> { a.chomp!(nil) }.should.raise(FrozenError) + -> { a.chomp!("x") }.should.raise(FrozenError) end end @@ -346,7 +346,7 @@ describe "String#chomp!" do end it "returns nil when the String is not modified" do - "あれ".chomp!.should be_nil + "あれ".chomp!.should == nil end it "removes the final carriage return, newline from a multibyte String" do |
