Created
September 17, 2015 16:07
-
-
Save jasonkarns/f009fa582315fae87cfb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# named captures shouldn't *have* to be compared as a hash; | |
# MatchData still returns the captures as a plain indexed array, | |
# so matching against the indexed captures should still be allowed | |
it "matches indexed captures against named captures" do | |
expect(Regexp.new("(?<num>123)")).to match("a123a").with_captures("123") | |
end | |
# doesn't make sense to show the expected captures if the match itself fails; they're irrelevant at that point | |
it "shows plain match failure message if match itself fails" do | |
expect { | |
expect(/(a)/).to match("123").with_captures() | |
}.to fail_with(/expected \/(a)\/ to match "123"/) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment