Test mailbluster request body

This commit is contained in:
Ziyi 2021-03-14 13:43:20 -07:00 committed by CactusPuppy
parent d99487b19c
commit 209d848079
No known key found for this signature in database
GPG key ID: 4B33B0A3E15E2C82
2 changed files with 11 additions and 9 deletions

View file

@ -14,13 +14,13 @@ module External
'subscribed' => true, 'subscribed' => true,
'tags' => ["snapcon"], 'tags' => ["snapcon"],
'overrideExisting' => true}.to_json 'overrideExisting' => true}.to_json
puts request puts request.body.to_json
response = http.request(request) response = http.request(request)
puts response puts response.body.to_json
return true return response.to_json
rescue => e rescue => e
puts "ERROR #{e}" puts "ERROR #{e}"
return false return nil
end end
end end
end end

View file

@ -31,15 +31,17 @@ describe External::MailblusterHelper, type: :helper do
"source": "Lead API" "source": "Lead API"
}, },
"tags": [ "tags": [
"iPhone User", "snapcon"
"Startup"
], ],
"createdAt": "2016-07-23T08:03:18.954Z",
"updatedAt": "2016-07-23T08:03:18.954Z"
} }
}', status: 200) }', status: 200)
create_lead(user) create_lead(user)
expect(WebMock).to have_requested(:post, "api.mailbluster.com/api/leads") expect(WebMock).to have_requested(:post, "api.mailbluster.com/api/leads").with(body: {
'firstName': user.name,
'email': user.email,
'subscribed': true,
'tags': ["snapcon"],
'overrideExisting': true})
end end
end end
end end