Get WebMock matchers to work

This commit is contained in:
CactusPuppy 2021-03-14 13:54:44 -07:00
parent 209d848079
commit bad73c5d8b
No known key found for this signature in database
GPG key ID: 4B33B0A3E15E2C82
2 changed files with 7 additions and 4 deletions

View file

@ -9,11 +9,13 @@ module External
http = Net::HTTP.new(uri.host, uri.port) http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.path, request = Net::HTTP::Post.new(uri.path,
{'Authorization' => ENV["MAILBLUSTER_API_KEY"]}) # TODO Authorization=APIKEY {'Authorization' => ENV["MAILBLUSTER_API_KEY"]}) # TODO Authorization=APIKEY
request.body = {'firstName' => user.name, request.body = {
'email' => user.email, 'email' => user.email,
'firstName' => user.name,
'overrideExisting' => true,
'subscribed' => true, 'subscribed' => true,
'tags' => ["snapcon"], 'tags' => ["snapcon"],
'overrideExisting' => true}.to_json }.to_json
puts request.body.to_json puts request.body.to_json
response = http.request(request) response = http.request(request)
puts response.body.to_json puts response.body.to_json

View file

@ -37,11 +37,12 @@ describe External::MailblusterHelper, type: :helper do
}', status: 200) }', status: 200)
create_lead(user) create_lead(user)
expect(WebMock).to have_requested(:post, "api.mailbluster.com/api/leads").with(body: { expect(WebMock).to have_requested(:post, "api.mailbluster.com/api/leads").with(body: {
'firstName': user.name,
'email': user.email, 'email': user.email,
'firstName': user.name,
'overrideExisting': true,
'subscribed': true, 'subscribed': true,
'tags': ["snapcon"], 'tags': ["snapcon"],
'overrideExisting': true}) }.to_json)
end end
end end
end end