Get WebMock matchers to work
This commit is contained in:
parent
209d848079
commit
bad73c5d8b
2 changed files with 7 additions and 4 deletions
6
app/helpers/external/mailbluster_helper.rb
vendored
6
app/helpers/external/mailbluster_helper.rb
vendored
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue