Fix up spec to properly pass under expectations
This commit is contained in:
parent
125c17838c
commit
0f6881414b
2 changed files with 5 additions and 5 deletions
4
app/helpers/external/mailbluster_helper.rb
vendored
4
app/helpers/external/mailbluster_helper.rb
vendored
|
|
@ -21,7 +21,7 @@ module External
|
|||
'tags' => ['snapcon']
|
||||
}.to_json
|
||||
response = http.request(request)
|
||||
response.to_json
|
||||
response.body
|
||||
rescue StandardError => e
|
||||
puts "ERROR #{e}"
|
||||
nil
|
||||
|
|
@ -34,7 +34,7 @@ module External
|
|||
request = Net::HTTP::Delete.new(uri.path,
|
||||
'Authorization' => ENV['MAILBLUSTER_API_KEY'])
|
||||
response = http.request(request)
|
||||
response.to_json
|
||||
response.body
|
||||
rescue StandardError => e
|
||||
puts "ERROR #{e}"
|
||||
nil
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ require 'webmock/rspec'
|
|||
|
||||
describe External::MailblusterHelper, type: :helper do
|
||||
let!(:user) { create(:user) }
|
||||
url = 'https://api.mailbluster.com/api/leads/'
|
||||
url = 'http://api.mailbluster.com:443/api/leads/'
|
||||
|
||||
describe 'create_lead' do
|
||||
it 'makes a post request to Mailbluster\'s API and gets the correct response' do
|
||||
|
|
@ -27,7 +27,7 @@ describe External::MailblusterHelper, type: :helper do
|
|||
.to_return(body: response_body, status: 200)
|
||||
response = create_lead(user)
|
||||
|
||||
expect(WebMock).to have_requested(:post, 'api.mailbluster.com/api/leads').with(body: {
|
||||
expect(WebMock).to have_requested(:post, url).with(body: {
|
||||
'email': user.email,
|
||||
'firstName': user.name,
|
||||
'overrideExisting': true,
|
||||
|
|
@ -44,7 +44,7 @@ describe External::MailblusterHelper, type: :helper do
|
|||
response_body = "{
|
||||
\"message\":\"Lead deleted\",
|
||||
\"leadHash\":\"#{email_hash}\"
|
||||
}"
|
||||
}"
|
||||
lead_url = url + email_hash.to_s
|
||||
stub_request(:delete, lead_url)
|
||||
.to_return(body: response_body)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue