Commit 4c591b1b authored by Sam Wiskow's avatar Sam Wiskow
Browse files

test(rule): restore single-quoted regex strings in YAML parity spec

My previous rewrite of the cross-format parity block accidentally
re-introduced double-escaped double-quoted strings ("...\\\\d+...")
that @reprazent had already asked to be replaced with single-quoted
literals on an earlier iteration. Switch back to single-quoted Ruby
strings + a single-quoted heredoc so the literal '\d' survives Ruby
string processing and reaches the YAML parser intact.

Co-Authored-By: default avatarClaude Opus 4.7 (1M context) <noreply@anthropic.com>
parent ef6dc8e8
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -218,11 +218,11 @@ RSpec.describe Labkit::RateLimit::Rule do
  describe "cross-format parity (Ruby Hash and YAML)" do
    it "produces equal Matcher hashes from a Ruby Hash and a YAML.safe_load Hash" do
      require "yaml"
      ruby_form = { request_type: "api", path: { re: "^/api/v\\d+/projects" } }
      yaml_form = YAML.safe_load(<<~YAML, symbolize_names: true)
      ruby_form = { request_type: "api", path: { re: '^/api/v\d+/projects' } }
      yaml_form = YAML.safe_load(<<~'YAML', symbolize_names: true)
        request_type: api
        path:
          re: "^/api/v\\\\d+/projects"
          re: '^/api/v\d+/projects'
      YAML

      ruby_rule = valid_rule(match: ruby_form)