Skip to content

Commit

Permalink
Update API version for test
Browse files Browse the repository at this point in the history
  • Loading branch information
leesheppard committed Dec 16, 2023
1 parent fe56b46 commit 1194508
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
8 changes: 4 additions & 4 deletions spec/features/committee_imports_members_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@

scenario "accepts an invitation" do
stub_request(
:get, %r{https://api.createsend.com/api/v3.2/subscribers/.*\.json}
:get, %r{https://api.createsend.com/api/v3.3/subscribers/.*\.json}
).and_return(
body: JSON.dump("State" => "Active"),
headers: { "Content-Type" => "application/json" }
Expand All @@ -97,7 +97,7 @@

expect(
a_request(
:get, %r{https://api.createsend.com/api/v3.2/subscribers/.*\.json}
:get, %r{https://api.createsend.com/api/v3.3/subscribers/.*\.json}
)
).to have_been_made.times(MailingList.all.length)

Expand All @@ -113,7 +113,7 @@

scenario "accepts an invitation without a provided name" do
stub_request(
:get, %r{https://api.createsend.com/api/v3.2/subscribers/.*\.json}
:get, %r{https://api.createsend.com/api/v3.3/subscribers/.*\.json}
).and_return(
body: JSON.dump("State" => "Active"),
headers: { "Content-Type" => "application/json" }
Expand All @@ -138,7 +138,7 @@

expect(
a_request(
:get, %r{https://api.createsend.com/api/v3.2/subscribers/.*\.json}
:get, %r{https://api.createsend.com/api/v3.3/subscribers/.*\.json}
)
).to have_been_made.times(MailingList.all.length)

Expand Down
6 changes: 3 additions & 3 deletions spec/features/committee_manages_list_webhooks_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

RSpec.feature "Committee manages list webhooks", type: :request do
scenario "registering webhooks" do
MailingList.all.find_each do |list|
stub_request(:post, "https://api.createsend.com/api/v3.2/lists/#{list.api_id}/webhooks.json")
MailingList.all.find do |list|
stub_request(:post, "https://api.createsend.com/api/v3.3/lists/#{list.api_id}/webhooks.json")
end

MailingList::CreateWebhooks.call

MailingList.all.find_each do |list|
expect(
a_request(:post, "https://api.createsend.com/api/v3.2/lists/#{list.api_id}/webhooks.json")
a_request(:post, "https://api.createsend.com/api/v3.3/lists/#{list.api_id}/webhooks.json")
).to have_been_made
end
end
Expand Down
6 changes: 3 additions & 3 deletions spec/features/committee_sychronises_mailing_lists_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
jules = FactoryBot.create :user

stub_request(
:get, %r{https://api.createsend.com/api/v3.2/lists/conf-key/active.json}
:get, %r{https://api.createsend.com/api/v3.3/lists/conf-key/active.json}
).to_return(
body: JSON.dump(
{
Expand All @@ -26,7 +26,7 @@
)

stub_request(
:get, %r{https://api.createsend.com/api/v3.2/lists/girls-key/active.json}
:get, %r{https://api.createsend.com/api/v3.3/lists/girls-key/active.json}
).to_return(
body: JSON.dump(
{
Expand All @@ -42,7 +42,7 @@
)

stub_request(
:get, %r{https://api.createsend.com/api/v3.2/lists/camp-key/active.json}
:get, %r{https://api.createsend.com/api/v3.3/lists/camp-key/active.json}
).to_return(
body: JSON.dump(
{
Expand Down
10 changes: 5 additions & 5 deletions spec/features/user_confirms_email_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,29 @@

scenario "by clicking the link in an email" do
stub_request(
:get, %r{https://api.createsend.com/api/v3.2/subscribers/camp-key.json}
:get, %r{https://api.createsend.com/api/v3.3/subscribers/camp-key.json}
).and_return(
body: JSON.dump("State" => "Active"),
headers: { "Content-Type" => "application/json" }
)

stub_request(
:get, %r{https://api.createsend.com/api/v3.2/subscribers/conf-key.json}
:get, %r{https://api.createsend.com/api/v3.3/subscribers/conf-key.json}
).and_return(
body: JSON.dump("State" => "Unsubscribed"),
headers: { "Content-Type" => "application/json" }
)

stub_request(
:get, %r{https://api.createsend.com/api/v3.2/subscribers/girls-key.json}
:get, %r{https://api.createsend.com/api/v3.3/subscribers/girls-key.json}
).and_return(
status: 400,
body: JSON.dump("Code" => 203, "Message" => "Subscriber not in list"),
headers: { "Content-Type" => "application/json" }
)

stub_request(
:post, "https://api.createsend.com/api/v3.2/subscribers/camp-key.json"
:post, "https://api.createsend.com/api/v3.3/subscribers/camp-key.json"
)

user
Expand All @@ -56,7 +56,7 @@

expect(
a_request(
:post, "https://api.createsend.com/api/v3.2/subscribers/camp-key.json"
:post, "https://api.createsend.com/api/v3.3/subscribers/camp-key.json"
)
).to have_been_made.once
end
Expand Down
14 changes: 7 additions & 7 deletions spec/features/user_edits_details_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
user.update mailing_lists: { "RubyConf AU" => "true" }
new_email = '[email protected]'
stub_request(
:post, %r{https://api.createsend.com/api/v3.2/subscribers/conf-key.json}
:post, %r{https://api.createsend.com/api/v3.3/subscribers/conf-key.json}
)
stub_request(
:put, %r{https://api.createsend.com/api/v3.2/subscribers/conf-key.json}
:put, %r{https://api.createsend.com/api/v3.3/subscribers/conf-key.json}
)

click_on 'Edit'
Expand All @@ -40,14 +40,14 @@

expect(
a_request(
:post, %r{https://api.createsend.com/api/v3.2/subscribers/conf-key.json}
:post, %r{https://api.createsend.com/api/v3.3/subscribers/conf-key.json}
)
).to have_been_made
end

scenario "subscribing to a mailing list" do
stub_request(
:post, "https://api.createsend.com/api/v3.2/subscribers/girls-key.json"
:post, "https://api.createsend.com/api/v3.3/subscribers/girls-key.json"
)

click_on "Edit"
Expand All @@ -60,15 +60,15 @@

expect(
a_request(
:post, "https://api.createsend.com/api/v3.2/subscribers/girls-key.json"
:post, "https://api.createsend.com/api/v3.3/subscribers/girls-key.json"
)
).to have_been_made.once
end

scenario "unsubscribing from a mailing list" do
user.update mailing_lists: { "RailsGirls" => "true" }
stub_request(
:post, "https://api.createsend.com/api/v3.2/subscribers/girls-key/unsubscribe.json"
:post, "https://api.createsend.com/api/v3.3/subscribers/girls-key/unsubscribe.json"
)

click_on "Edit"
Expand All @@ -81,7 +81,7 @@

expect(
a_request(
:post, "https://api.createsend.com/api/v3.2/subscribers/girls-key/unsubscribe.json"
:post, "https://api.createsend.com/api/v3.3/subscribers/girls-key/unsubscribe.json"
)
).to have_been_made.once
end
Expand Down

0 comments on commit 1194508

Please sign in to comment.