Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
402baca0
Commit
402baca0
authored
May 04, 2021
by
Nicolas Dular
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add more specs
Improves test coverage of the base class
parent
6107273f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
4 deletions
+68
-4
lib/gitlab/email/message/in_product_marketing/base.rb
lib/gitlab/email/message/in_product_marketing/base.rb
+4
-4
spec/lib/gitlab/email/message/in_product_marketing/base_spec.rb
...ib/gitlab/email/message/in_product_marketing/base_spec.rb
+64
-0
No files found.
lib/gitlab/email/message/in_product_marketing/base.rb
View file @
402baca0
...
...
@@ -16,10 +16,6 @@ module Gitlab
attr_accessor
:format
def
track
self
.
class
.
name
.
demodulize
.
downcase
.
to_sym
end
def
subject_line
raise
NotImplementedError
end
...
...
@@ -109,6 +105,10 @@ module Gitlab
private
def
track
self
.
class
.
name
.
demodulize
.
downcase
.
to_sym
end
def
unsubscribe_com
[
s_
(
'InProductMarketing|If you no longer wish to receive marketing emails from us,'
),
...
...
spec/lib/gitlab/email/message/in_product_marketing/base_spec.rb
0 → 100644
View file @
402baca0
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Gitlab
::
Email
::
Message
::
InProductMarketing
::
Base
do
let_it_be
(
:group
)
{
build
(
:group
)
}
let
(
:series
)
{
0
}
let
(
:test_class
)
{
Gitlab
::
Email
::
Message
::
InProductMarketing
::
Create
}
describe
'#logo_path'
do
subject
{
test_class
.
new
(
group:
group
,
series:
series
).
logo_path
}
it
{
is_expected
.
to
eq
(
'mailers/in_product_marketing/create-0.png'
)
}
end
describe
'#unsubscribe'
do
subject
{
test_class
.
new
(
group:
group
,
series:
series
).
unsubscribe
}
before
do
allow
(
Gitlab
).
to
receive
(
:com?
).
and_return
(
is_gitlab_com
)
end
context
'on gitlab.com'
do
let
(
:is_gitlab_com
)
{
true
}
it
{
is_expected
.
to
include
(
'%tag_unsubscribe_url%'
)
}
end
context
'not on gitlab.com'
do
let
(
:is_gitlab_com
)
{
false
}
it
{
is_expected
.
to
include
(
Gitlab
::
Routing
.
url_helpers
.
profile_notifications_url
)
}
end
end
describe
'#cta_link'
do
subject
(
:cta_link
)
{
test_class
.
new
(
group:
group
,
series:
series
).
cta_link
}
it
'renders link'
do
expect
(
CGI
.
unescapeHTML
(
cta_link
)).
to
include
(
Gitlab
::
Routing
.
url_helpers
.
group_email_campaigns_url
(
group
,
track: :create
,
series:
series
))
end
end
describe
'#progress'
do
subject
{
test_class
.
new
(
group:
group
,
series:
series
).
progress
}
before
do
allow
(
Gitlab
).
to
receive
(
:com?
).
and_return
(
is_gitlab_com
)
end
context
'on gitlab.com'
do
let
(
:is_gitlab_com
)
{
true
}
it
{
is_expected
.
to
include
(
'This is email 1 of 3 in the Create series'
)
}
end
context
'not on gitlab.com'
do
let
(
:is_gitlab_com
)
{
false
}
it
{
is_expected
.
to
include
(
'This is email 1 of 3 in the Create series'
,
Gitlab
::
Routing
.
url_helpers
.
profile_notifications_url
)
}
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment