Skip to content

Commit

Permalink
fix: regression - prevous matching rules change broke specification t…
Browse files Browse the repository at this point in the history
…ests #359
  • Loading branch information
rholshausen committed Jan 19, 2024
1 parent a77c9eb commit 0f5f563
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions rust/pact_models/src/matchingrules/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ impl MatchingRuleCategory {
self.add_rule_list(DocPath::empty(), rules)?;
} else if self.name == Category::QUERY || self.name == Category::HEADER {
for (k, v) in m {
let mut path = DocPath::empty();
let mut path = DocPath::root();
path.push_field(k);
self.add_rule_list(path, v)?;
}
Expand Down Expand Up @@ -1824,11 +1824,11 @@ mod tests {
}));
expect!(matching_rules.rules_for_category("query")).to(be_some().value(MatchingRuleCategory {
name: "query".into(),
rules: hashmap!{ DocPath::empty().join("Q1") => RuleList { rules: vec![ MatchingRule::Regex("\\d+".to_string()) ], rule_logic: RuleLogic::And, cascaded: false } }
rules: hashmap!{ DocPath::root().join("Q1") => RuleList { rules: vec![ MatchingRule::Regex("\\d+".to_string()) ], rule_logic: RuleLogic::And, cascaded: false } }
}));
expect!(matching_rules.rules_for_category("header")).to(be_some().value(MatchingRuleCategory {
name: "header".into(),
rules: hashmap!{ DocPath::empty().join("HEADERY") => RuleList { rules: vec![
rules: hashmap!{ DocPath::root().join("HEADERY") => RuleList { rules: vec![
MatchingRule::Include("ValueA".to_string()),
MatchingRule::Include("ValueB".to_string()) ], rule_logic: RuleLogic::Or, cascaded: false } }
}));
Expand Down Expand Up @@ -1933,11 +1933,11 @@ mod tests {
}));
expect!(matching_rules.rules_for_category("query")).to(be_some().value(MatchingRuleCategory {
name: "query".into(),
rules: hashmap!{ DocPath::empty().join("Q[]") => RuleList { rules: vec![ MatchingRule::Regex("\\d+".to_string()) ], rule_logic: RuleLogic::And, cascaded: false } }
rules: hashmap!{ DocPath::root().join("Q[]") => RuleList { rules: vec![ MatchingRule::Regex("\\d+".to_string()) ], rule_logic: RuleLogic::And, cascaded: false } }
}));
expect!(matching_rules.rules_for_category("header")).to(be_some().value(MatchingRuleCategory {
name: "header".into(),
rules: hashmap!{ DocPath::empty().join("Y[]") => RuleList { rules: vec![
rules: hashmap!{ DocPath::root().join("Y[]") => RuleList { rules: vec![
MatchingRule::Include("ValueA".to_string()),
MatchingRule::Include("ValueB".to_string()) ], rule_logic: RuleLogic::Or, cascaded: false } }
}));
Expand Down

0 comments on commit 0f5f563

Please sign in to comment.