Fixed spec @user
This commit is contained in:
parent
7f60f8aace
commit
af4ec41f87
2 changed files with 3 additions and 2 deletions
3
app/helpers/external/mailbluster_helper.rb
vendored
3
app/helpers/external/mailbluster_helper.rb
vendored
|
|
@ -5,7 +5,7 @@ module External
|
||||||
def create_lead(user)
|
def create_lead(user)
|
||||||
# TODO
|
# TODO
|
||||||
begin
|
begin
|
||||||
uri = URI("api.mailbluster.com/api/leads")
|
uri = URI("http://api.mailbluster.com/api/leads")
|
||||||
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
|
||||||
|
|
@ -14,6 +14,7 @@ module External
|
||||||
'subscribed' => true,
|
'subscribed' => true,
|
||||||
'tags' => ["snapcon"],
|
'tags' => ["snapcon"],
|
||||||
'overrideExisting' => true}.to_json
|
'overrideExisting' => true}.to_json
|
||||||
|
puts request
|
||||||
response = http.request(request)
|
response = http.request(request)
|
||||||
puts response
|
puts response
|
||||||
return true
|
return true
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ describe External::MailblusterHelper, type: :helper do
|
||||||
|
|
||||||
describe 'create_lead' do
|
describe 'create_lead' do
|
||||||
it 'makes a post request to Mailbluster\'s API' 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").
|
expect(WebMock).to have_requested(:post, "api.mailbluster.com/api/leads").
|
||||||
with { |req| req.body == "abc" }
|
with { |req| req.body == "abc" }
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue