Skip to content

Commit

Permalink
chore: repro pact-support-issue-50
Browse files Browse the repository at this point in the history
  • Loading branch information
YOU54F committed Aug 15, 2024
1 parent 01dfa81 commit 4d66c15
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
4 changes: 3 additions & 1 deletion consumer/spec/bar_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
headers: { 'Content-Type' => 'application/json' },
body: {
company: Pact.like("My big company"),
factories: Pact.each_like(location: "Sydney", capacity: 5)
factories: Pact.each_like(location: "Sydney", capacity: 5),
received_at: Pact.term(generate: "2017-10-23T11:50:12Z", matcher: /^\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)$/),
received_at_matcher: Pact.like_datetime("2017-10-23T11:50:12Z")
}
})

Expand Down
12 changes: 11 additions & 1 deletion consumer/spec/pacts/foo-bar.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
"location": "Sydney",
"capacity": 5
}
]
],
"received_at": "2017-10-23T11:50:12Z",
"received_at_matcher": "2017-10-23T11:50:12Z"
},
"matchingRules": {
"$.body.company": {
Expand All @@ -38,6 +40,14 @@
},
"$.body.factories[*].*": {
"match": "type"
},
"$.body.received_at": {
"match": "regex",
"regex": "^\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d([+-][0-2]\\d:[0-5]\\d|Z)$"
},
"$.body.received_at_matcher": {
"match": "regex",
"regex": "^\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d([+-][0-2]\\d:[0-5]\\d|Z)$"
}
}
}
Expand Down
7 changes: 5 additions & 2 deletions provider/bar_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ def call env
"location": "Sydney",
"geographicCoords": "-0.145,1.4445",
"capacity": 5,
}
]
},
],
"received_at": "2017-10-25T01:26:00Z",
"received_at_matcher": "2017-10-25T01:26:00Z"

}.to_json
[status, headers, [body]]
end
Expand Down

0 comments on commit 4d66c15

Please sign in to comment.