Add spec for deleting leads
This commit is contained in:
parent
59908e60e4
commit
fddd6ecd9f
1 changed files with 13 additions and 0 deletions
13
spec/helpers/external/mailbluster_helper_spec.rb
vendored
13
spec/helpers/external/mailbluster_helper_spec.rb
vendored
|
|
@ -36,4 +36,17 @@ describe External::MailblusterHelper, type: :helper do
|
|||
expect(response).to eq(response_body)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'delete_lead' do
|
||||
it 'correctly requests the right URL and gets a valid response' do
|
||||
email_hash = Digest::MD5.hexdigest user.email
|
||||
response_body = "{\"message\":\"Lead deleted\",\"leadHash\":\"#{email_hash}\"}"
|
||||
stub_request(:delete, "https://api.mailbluster.com/api/leads/#{email_hash}")
|
||||
.to_return(body: response_body)
|
||||
response = delete_lead(user)
|
||||
|
||||
expect(WebMock).to have_requested(:delete, "api.mailbluster.com/api/leads/#{email_hash}")
|
||||
expect(response).to eq(response_body)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue