summaryrefslogtreecommitdiff
path: root/spec/ruby/library/stringscanner/check_until_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/stringscanner/check_until_spec.rb')
-rw-r--r--spec/ruby/library/stringscanner/check_until_spec.rb20
1 files changed, 7 insertions, 13 deletions
diff --git a/spec/ruby/library/stringscanner/check_until_spec.rb b/spec/ruby/library/stringscanner/check_until_spec.rb
index 701a703ebe..b4ef35d9f7 100644
--- a/spec/ruby/library/stringscanner/check_until_spec.rb
+++ b/spec/ruby/library/stringscanner/check_until_spec.rb
@@ -24,7 +24,7 @@ describe "StringScanner#check_until" do
it "raises TypeError if given a String" do
-> {
@s.check_until('T')
- }.should raise_error(TypeError, 'wrong argument type String (expected Regexp)')
+ }.should.raise(TypeError, 'wrong argument type String (expected Regexp)')
end
end
@@ -35,7 +35,6 @@ describe "StringScanner#check_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.check_until("a")
@@ -45,7 +44,6 @@ describe "StringScanner#check_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
@@ -69,34 +67,32 @@ describe "StringScanner#check_until" do
it "returns nil when matching failed" do
@s.check_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 #check_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.check_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.check_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.check_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
@@ -105,7 +101,6 @@ describe "StringScanner#check_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)/)
@@ -114,10 +109,9 @@ describe "StringScanner#check_until" do
@s.check_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.0"..."3.4.3"
it "ignores the previous matching with Regexp" do
@s.exist?(/(?<a>This)/)
@@ -126,7 +120,7 @@ describe "StringScanner#check_until" do
@s.check_until("This")
@s.should.matched?
- -> { @s[:a] }.should raise_error(IndexError)
+ -> { @s[:a] }.should.raise(IndexError)
end
end
end