summaryrefslogtreecommitdiff
path: root/spec/ruby/library/stringscanner/check_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/stringscanner/check_spec.rb')
-rw-r--r--spec/ruby/library/stringscanner/check_spec.rb16
1 files changed, 6 insertions, 10 deletions
diff --git a/spec/ruby/library/stringscanner/check_spec.rb b/spec/ruby/library/stringscanner/check_spec.rb
index 235f2f22e9..232158b09e 100644
--- a/spec/ruby/library/stringscanner/check_spec.rb
+++ b/spec/ruby/library/stringscanner/check_spec.rb
@@ -33,33 +33,31 @@ describe "StringScanner#check" do
it "returns nil when matching failed" do
@s.check(/(?<a>2008)/)
@s.should_not.matched?
- @s[:a].should be_nil
+ @s[:a].should == nil
end
end
context "when #check 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("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 "raises IndexError when matching succeeded" do
@s.check("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("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
@@ -68,7 +66,6 @@ describe "StringScanner#check" 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)/)
@@ -77,10 +74,9 @@ describe "StringScanner#check" do
@s.check("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)/)
@@ -89,7 +85,7 @@ describe "StringScanner#check" do
@s.check("This")
@s.should.matched?
- -> { @s[:a] }.should raise_error(IndexError)
+ -> { @s[:a] }.should.raise(IndexError)
end
end
end