Commit 0603678a authored by David Fernandez's avatar David Fernandez

Merge branch 'nicolasdular/fix-in-product-email' into 'master'

Fix call on nil for in-product marketing email

See merge request gitlab-org/gitlab!56025
parents cdf5ca42 cd6aac17
...@@ -343,7 +343,7 @@ module InProductMarketingHelper ...@@ -343,7 +343,7 @@ module InProductMarketingHelper
end end
end end
def inline_image_link(folder, image, **options) def inline_image_link(folder, image, options)
attachments.inline[image] = File.read(Rails.root.join("app/assets/images", folder, image)) attachments.inline[image] = File.read(Rails.root.join("app/assets/images", folder, image))
image_tag attachments[image].url, **options image_tag attachments[image].url, **options
end end
......
...@@ -177,8 +177,9 @@ ...@@ -177,8 +177,9 @@
%td{ style: "padding: 10px 20px 30px 20px; font-family: 'Source Sans Pro', helvetica, arial, sans-serif; color:#000000; font-size: 18px; line-height: 24px;" } %td{ style: "padding: 10px 20px 30px 20px; font-family: 'Source Sans Pro', helvetica, arial, sans-serif; color:#000000; font-size: 18px; line-height: 24px;" }
%p{ style: "margin: 0 0 20px 0;" } %p{ style: "margin: 0 0 20px 0;" }
= in_product_marketing_body_line1(@track, @series, format: :html).html_safe = in_product_marketing_body_line1(@track, @series, format: :html).html_safe
- in_product_marketing_body_line2(@track, @series, format: :html)&.tap do |line|
%p{ style: "margin: 0 0 20px 0;" } %p{ style: "margin: 0 0 20px 0;" }
= in_product_marketing_body_line2(@track, @series, format: :html).html_safe = line.html_safe
%tr %tr
%td{ align: "center", style: "padding: 10px 20px 80px 20px; font-family: 'Source Sans Pro', helvetica, arial, sans-serif;" } %td{ align: "center", style: "padding: 10px 20px 80px 20px; font-family: 'Source Sans Pro', helvetica, arial, sans-serif;" }
.cta_link= cta_link(@track, @series, @group, format: :html) .cta_link= cta_link(@track, @series, @group, format: :html)
......
# frozen_string_literal: true
require 'spec_helper'
require 'email_spec'
RSpec.describe Emails::InProductMarketing do
include EmailSpec::Matchers
include InProductMarketingHelper
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group) }
describe '#in_product_marketing_email' do
using RSpec::Parameterized::TableSyntax
where(:track, :series) do
:create | 0
:create | 1
:create | 2
:verify | 0
:verify | 1
:verify | 2
:trial | 0
:trial | 1
:trial | 2
:team | 0
:team | 1
:team | 2
end
with_them do
subject { Notify.in_product_marketing_email(user.id, group.id, track, series) }
it 'has the correct subject and content' do
aggregate_failures do
is_expected.to have_subject(subject_line(track, series))
is_expected.to have_body_text(in_product_marketing_title(track, series))
is_expected.to have_body_text(in_product_marketing_subtitle(track, series))
is_expected.to have_body_text(in_product_marketing_cta_text(track, series))
end
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment