Begin writing tests for Mailbluster API calls

This commit is contained in:
CactusPuppy 2021-03-13 15:04:57 -08:00
parent c6c2c4e264
commit 27baa935c1
No known key found for this signature in database
GPG key ID: 4B33B0A3E15E2C82
3 changed files with 29 additions and 0 deletions

View file

@ -0,0 +1,9 @@
# frozen_string_literal: true
module External
module Mailbluster
def create_lead(user)
# TODO
end
end
end

View file

@ -0,0 +1,16 @@
# frozen_string_literal: true
require 'spec_helper'
require 'webmock/rspec'
describe MailblusterHelper, type: :helper do
let!(:user) { create(:user) }
describe 'create_lead' do
it 'makes a post request to Mailbluster\'s API' do
create_lead(@user)
expect(WebMock).to have_requested(:post, "api.mailbluster.com/api/leads").
with { |req| req.body == "abc" }
end
end
end

View file

@ -12,6 +12,10 @@ SimpleCov.start 'rails'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
# Prevent tests from making calls to the Internet
require 'webmock/rspec'
WebMock.disable_net_connect!(allow_localhost: true)
require 'rspec/rails'
require 'shoulda/matchers'
require 'webdrivers'