Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# 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("(?<num>123)")).to match("a123a").with_captures("123")
# 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"/)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment