diff options
Diffstat (limited to 'spec/ruby/library/stringscanner/scan_until_spec.rb')
| -rw-r--r-- | spec/ruby/library/stringscanner/scan_until_spec.rb | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/spec/ruby/library/stringscanner/scan_until_spec.rb b/spec/ruby/library/stringscanner/scan_until_spec.rb index 737d83a14c..df83f3916a 100644 --- a/spec/ruby/library/stringscanner/scan_until_spec.rb +++ b/spec/ruby/library/stringscanner/scan_until_spec.rb @@ -31,7 +31,7 @@ describe "StringScanner#scan_until" do it "raises TypeError if given a String" do -> { @s.scan_until('T') - }.should raise_error(TypeError, 'wrong argument type String (expected Regexp)') + }.should.raise(TypeError, 'wrong argument type String (expected Regexp)') end end @@ -41,7 +41,6 @@ describe "StringScanner#scan_until" do end # https://github.com/ruby/strscan/issues/131 - ruby_version_is ""..."3.5" do # Don't run on 3.5.0dev that already contains not released fixes version_is StringScanner::Version, "3.1.1"..."3.1.3" do # ruby_version_is "3.4.1" it "sets the last match result if given a String" do @s.scan_until("a") @@ -51,7 +50,6 @@ describe "StringScanner#scan_until" do @s.post_match.should == " test" end end - end version_is StringScanner::Version, "3.1.3" do # ruby_version_is "3.4" it "sets the last match result if given a String" do @@ -75,34 +73,32 @@ describe "StringScanner#scan_until" do it "returns nil when matching failed" do @s.scan_until(/(?<a>2008)/) @s.should_not.matched? - @s[:a].should be_nil + @s[:a].should == nil end end version_is StringScanner::Version, "3.1.1" do # ruby_version_is "3.4" context "when #scan_until was called with a String pattern" do # https://github.com/ruby/strscan/issues/139 - ruby_version_is ""..."3.5" do # Don't run on 3.5.0dev that already contains not released fixes version_is StringScanner::Version, "3.1.1"..."3.1.3" do # ruby_version_is "3.4.0"..."3.4.3" it "returns nil when matching succeeded" do @s.scan_until("This") @s.should.matched? - @s[:a].should be_nil + @s[:a].should == nil end end - end version_is StringScanner::Version, "3.1.3" do # ruby_version_is "3.4.3" it "raises IndexError when matching succeeded" do @s.scan_until("This") @s.should.matched? - -> { @s[:a] }.should raise_error(IndexError) + -> { @s[:a] }.should.raise(IndexError) end end it "returns nil when matching failed" do @s.scan_until("2008") @s.should_not.matched? - @s[:a].should be_nil + @s[:a].should == nil end it "returns a matching substring when given Integer index" do @@ -111,7 +107,6 @@ describe "StringScanner#scan_until" do end # https://github.com/ruby/strscan/issues/135 - ruby_version_is ""..."3.5" do # Don't run on 3.5.0dev that already contains not released fixes version_is StringScanner::Version, "3.1.1"..."3.1.3" do # ruby_version_is "3.4.0"..."3.4.3" it "ignores the previous matching with Regexp" do @s.exist?(/(?<a>This)/) @@ -120,10 +115,9 @@ describe "StringScanner#scan_until" do @s.scan_until("This") @s.should.matched? - @s[:a].should be_nil + @s[:a].should == nil end end - end version_is StringScanner::Version, "3.1.3" do # ruby_version_is "3.4" it "ignores the previous matching with Regexp" do @s.exist?(/(?<a>This)/) @@ -132,7 +126,7 @@ describe "StringScanner#scan_until" do @s.scan_until("This") @s.should.matched? - -> { @s[:a] }.should raise_error(IndexError) + -> { @s[:a] }.should.raise(IndexError) end end end |
