Called create_lead in model, FactoryBot errors

This commit is contained in:
Ziyi 2021-03-19 11:13:39 -07:00 committed by CactusPuppy
parent 09becbc3e0
commit f98f35ec8d
No known key found for this signature in database
GPG key ID: 4B33B0A3E15E2C82
3 changed files with 66 additions and 1 deletions

View file

@ -80,8 +80,27 @@ FactoryBot.define do
last_sign_in_at { Date.today }
is_disabled { false }
url_mailbluster = 'https://api.mailbluster.com/api/leads/'
response_body = "{
\"message\": \"Lead created\",
\"lead\": {
\"id\": 329395,
\"firstName\": \"#{name}\",
\"lastName\": \"\",
\"fullName\": \"#{name}\",
\"email\": \"#{email}\",
\"subscribed\": true,
\"tags\": [
#{ENV['OSEM_NAME'] || 'snapcon'}
],
}
}"
WebMock.stub_request(:post, url_mailbluster)
# Called by every user creation
after(:create) do |user|
user.is_admin = false
# save with bang cause we want change in DB and not just in object instance
user.save!
end