Skip to content

Commit

Permalink
Remove specialist topics from email alert api pact
Browse files Browse the repository at this point in the history
  • Loading branch information
unoduetre committed Apr 12, 2024
1 parent 25ffb1a commit 9a25ee5
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions test/pacts/email_alert_api_pact_test.rb
Expand Up @@ -23,7 +23,7 @@
{
id: Pact.like(1),
links: {},
tags: { topics: { any: ["motoring/road_rage"] } },
tags: { policies: { any: ["motoring/road_rage"] } },
document_type: "",
slug: Pact.like("title-1"),
title: Pact.like("title 1"),
Expand All @@ -39,7 +39,7 @@
path: "/subscriber-lists",
body: {
title: "new-title",
tags: { topics: { any: ["motoring/road_rage"] } },
tags: { policies: { any: ["motoring/road_rage"] } },
},
headers: GdsApi::JsonClient.default_request_with_json_body_headers,
)
Expand All @@ -53,19 +53,19 @@
},
)

api_client.find_or_create_subscriber_list(title: "new-title", tags: { topics: { any: ["motoring/road_rage"] } })
api_client.find_or_create_subscriber_list(title: "new-title", tags: { policies: { any: ["motoring/road_rage"] } })
end

it "responds with the subscriber list with an updated title" do
email_alert_api
.given("a subscriber list with the tag topic: motoring/road_rage exists")
.given("a subscriber list with the tag policy: motoring/road_rage exists")
.upon_receiving("a request to find or create a subscriber list")
.with(
method: :post,
path: "/subscriber-lists",
body: {
title: "new-title",
tags: { topics: { any: ["motoring/road_rage"] } },
tags: { policies: { any: ["motoring/road_rage"] } },
},
headers: GdsApi::JsonClient.default_request_with_json_body_headers,
)
Expand All @@ -79,7 +79,7 @@
},
)

api_client.find_or_create_subscriber_list(title: "new-title", tags: { topics: { any: ["motoring/road_rage"] } })
api_client.find_or_create_subscriber_list(title: "new-title", tags: { policies: { any: ["motoring/road_rage"] } })
end
end

Expand All @@ -92,7 +92,7 @@
path: "/subscriber-lists",
# Query here is odd because the parser doesn't quite handle
# the output of Rack::Utils.build_nested_query
query: { "tags[topics][any][]": ["motoring/road_rage"] },
query: { "tags[policies][any][]": ["motoring/road_rage"] },
headers: GdsApi::JsonClient.default_request_headers,
)
.will_respond_with(
Expand All @@ -104,22 +104,22 @@
)

begin
api_client.find_subscriber_list(tags: { topics: { any: ["motoring/road_rage"] } })
api_client.find_subscriber_list(tags: { policies: { any: ["motoring/road_rage"] } })
rescue GdsApi::HTTPNotFound
# We expect this to throw an exception
end
end

it "responds with the subscriber list" do
email_alert_api
.given("a subscriber list with the tag topic: motoring/road_rage exists")
.given("a subscriber list with the tag policy: motoring/road_rage exists")
.upon_receiving("a request for the subscriber list")
.with(
method: :get,
path: "/subscriber-lists",
# Query here is odd because the parser doesn't quite handle
# the output of Rack::Utils.build_nested_query
query: { "tags[topics][any][]": ["motoring/road_rage"] },
query: { "tags[policies][any][]": ["motoring/road_rage"] },
headers: GdsApi::JsonClient.default_request_headers,
)
.will_respond_with(
Expand All @@ -132,7 +132,7 @@
},
)

api_client.find_subscriber_list(tags: { topics: { any: ["motoring/road_rage"] } })
api_client.find_subscriber_list(tags: { policies: { any: ["motoring/road_rage"] } })
end
end

Expand Down

0 comments on commit 9a25ee5

Please sign in to comment.