Fixed spec @user

This commit is contained in:
Ziyi 2021-03-13 15:29:25 -08:00 committed by CactusPuppy
parent 5500fc8acf
commit cc57973103
No known key found for this signature in database
GPG key ID: 4B33B0A3E15E2C82
2 changed files with 3 additions and 2 deletions

View file

@ -5,7 +5,7 @@ module External
def create_lead(user)
# TODO
begin
uri = URI("api.mailbluster.com/api/leads")
uri = URI("http://api.mailbluster.com/api/leads")
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.path,
{'Authorization' => ENV["MAILBLUSTER_API_KEY"]}) # TODO Authorization=APIKEY
@ -14,6 +14,7 @@ module External
'subscribed' => true,
'tags' => ["snapcon"],
'overrideExisting' => true}.to_json
puts request
response = http.request(request)
puts response
return true

View file

@ -8,7 +8,7 @@ describe External::MailblusterHelper, type: :helper do
describe 'create_lead' do
it 'makes a post request to Mailbluster\'s API' do
create_lead(@user)
create_lead(user)
expect(WebMock).to have_requested(:post, "api.mailbluster.com/api/leads").
with { |req| req.body == "abc" }
end