Begin writing tests for Mailbluster API calls
This commit is contained in:
parent
c6c2c4e264
commit
27baa935c1
3 changed files with 29 additions and 0 deletions
9
app/helpers/external/mailbluster_helper.rb
vendored
Normal file
9
app/helpers/external/mailbluster_helper.rb
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module External
|
||||
module Mailbluster
|
||||
def create_lead(user)
|
||||
# TODO
|
||||
end
|
||||
end
|
||||
end
|
||||
16
spec/helpers/external/mailbluster_helper_spec.rb
vendored
Normal file
16
spec/helpers/external/mailbluster_helper_spec.rb
vendored
Normal 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
|
||||
|
|
@ -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'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue