diff options
Diffstat (limited to 'spec/ruby/core/string/index_spec.rb')
| -rw-r--r-- | spec/ruby/core/string/index_spec.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/spec/ruby/core/string/index_spec.rb b/spec/ruby/core/string/index_spec.rb index 01e6a6a400..3f82181b98 100644 --- a/spec/ruby/core/string/index_spec.rb +++ b/spec/ruby/core/string/index_spec.rb @@ -4,15 +4,15 @@ require_relative 'fixtures/classes' describe "String#index" do it "raises a TypeError if passed nil" do - -> { "abc".index nil }.should raise_error(TypeError) + -> { "abc".index nil }.should.raise(TypeError) end it "raises a TypeError if passed a boolean" do - -> { "abc".index true }.should raise_error(TypeError) + -> { "abc".index true }.should.raise(TypeError) end it "raises a TypeError if passed a Symbol" do - -> { "abc".index :a }.should raise_error(TypeError) + -> { "abc".index :a }.should.raise(TypeError) end it "calls #to_str to convert the first argument" do @@ -28,7 +28,7 @@ describe "String#index" do end it "raises a TypeError if passed an Integer" do - -> { "abc".index 97 }.should raise_error(TypeError) + -> { "abc".index 97 }.should.raise(TypeError) end end @@ -157,7 +157,7 @@ describe "String#index with String" do char = "れ".encode Encoding::EUC_JP -> do "あれ".index char - end.should raise_error(Encoding::CompatibilityError) + end.should.raise(Encoding::CompatibilityError) end it "handles a substring in a superset encoding" do @@ -172,7 +172,7 @@ describe "String#index with String" do str = 'abc'.dup.force_encoding("ISO-2022-JP") pattern = 'b'.dup.force_encoding("EUC-JP") - -> { str.index(pattern) }.should raise_error(Encoding::CompatibilityError, "incompatible character encodings: ISO-2022-JP and EUC-JP") + -> { str.index(pattern) }.should.raise(Encoding::CompatibilityError, "incompatible character encodings: ISO-2022-JP and EUC-JP") end end @@ -287,7 +287,7 @@ describe "String#index with Regexp" do end it "returns nil if the Regexp matches the empty string and the offset is out of range" do - "ruby".index(//,12).should be_nil + "ruby".index(//,12).should == nil end it "supports \\G which matches at the given start offset" do @@ -332,6 +332,6 @@ describe "String#index with Regexp" do re = Regexp.new "れ".encode(Encoding::EUC_JP) -> do "あれ".index re - end.should raise_error(Encoding::CompatibilityError, "incompatible encoding regexp match (EUC-JP regexp with UTF-8 string)") + end.should.raise(Encoding::CompatibilityError, "incompatible encoding regexp match (EUC-JP regexp with UTF-8 string)") end end |
