Massimiliano De Vivo
08/02/2022, 12:14 PMMassimiliano De Vivo
08/02/2022, 12:14 PMrequest_headers = { "Content-Type" => "application/x-www-form-urlencoded" }
request_body = URI.encode_www_form(
[
...
[
"device_id",
Pact.term(
generate: "3387FE91-453B-4237-B986-17F4F0DC0E13",
matcher: /^[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12}$/
)
]
...
]
)
interaction_mock_domain = "<http://127.0.0.1:9292>"
interaction_mock_path = "/interactions"
interaction_mock_headers = { "X-Pact-Mock-Service" => true }
interaction_mock_body = {
request: {
method: request_method,
path: request_path,
headers: request_headers,
body: request_body
},
response: {
body: response_body
}
}.to_json
RestClient::Request.execute(
url: interaction_mock_domain + interaction_mock_path,
method: :post,
headers: interaction_mock_headers,
payload: interaction_mock_body
)
but it seems to me that I must be passing it wrong overall,
because the term finally seems to not be matching (cause is maybe read as string):
...
* Expected "Pact::Term matcher: /^[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12}$/ generate: \"3387FE91-453B-4237-B986-17F4F0DC0E13\"" but got "3387FE91-453B-4237-B986-17F4F0DC0E13" at $.body.device_id[0]
...
Massimiliano De Vivo
08/02/2022, 1:53 PMrequest_body = {
..
"device_id" => Pact.term(
generate: "3387FE91-453B-4237-B986-17F4F0DC0E13",
matcher: /^[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12}$/
),
..
}
interaction_mock_body = {
request: {
method: request_method,
path: request_path,
headers: request_headers,
body: request_body
},
response: {
status: 200,
headers: response_headers,
body: response_body
}
}.to_json
Massimiliano De Vivo
08/02/2022, 1:53 PMTimothy Jones
08/02/2022, 11:01 PMTimothy Jones
08/02/2022, 11:01 PMBeth (pactflow.io/Pact Broker/pact-ruby)
Massimiliano De Vivo
08/03/2022, 7:17 AMBeth (pactflow.io/Pact Broker/pact-ruby)
Beth (pactflow.io/Pact Broker/pact-ruby)
Beth (pactflow.io/Pact Broker/pact-ruby)
Massimiliano De Vivo
08/05/2022, 7:13 AMTimothy Jones
08/05/2022, 7:28 AMMassimiliano De Vivo
08/05/2022, 7:59 AMTimothy Jones
08/05/2022, 8:11 AMTimothy Jones
08/05/2022, 8:11 AMTimothy Jones
08/05/2022, 8:12 AMTimothy Jones
08/05/2022, 8:13 AMMassimiliano De Vivo
08/05/2022, 8:13 AMBeth (pactflow.io/Pact Broker/pact-ruby)