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
f709e99f
Commit
f709e99f
authored
Jul 10, 2018
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move EE specific tests to their own file
parent
a251b8f6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
59 deletions
+59
-59
ee/spec/mailers/notify_spec.rb
ee/spec/mailers/notify_spec.rb
+59
-0
spec/mailers/notify_spec.rb
spec/mailers/notify_spec.rb
+0
-59
No files found.
ee/spec/mailers/notify_spec.rb
View file @
f709e99f
...
...
@@ -195,4 +195,63 @@ describe Notify do
end
end
end
describe
'mirror was hard failed'
do
let
(
:project
)
{
create
(
:project
,
:mirror
,
:import_hard_failed
)
}
subject
{
described_class
.
mirror_was_hard_failed_email
(
project
.
id
,
user
.
id
)
}
it_behaves_like
'an email sent from GitLab'
it_behaves_like
'it should not have Gmail Actions links'
it_behaves_like
"a user cannot unsubscribe through footer link"
it
'has the correct subject and body'
do
is_expected
.
to
have_subject
(
"
#{
project
.
name
}
| Repository mirroring paused"
)
is_expected
.
to
have_body_text
(
project
.
full_path
)
is_expected
.
to
have_body_text
(
project_settings_repository_url
(
project
))
end
end
describe
'mirror user changed'
do
let
(
:mirror_user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:mirror
,
mirror_user_id:
mirror_user
.
id
)
}
let
(
:new_mirror_user
)
{
project
.
team
.
owners
.
first
}
subject
{
described_class
.
project_mirror_user_changed_email
(
new_mirror_user
.
id
,
mirror_user
.
name
,
project
.
id
)
}
it_behaves_like
'an email sent from GitLab'
it_behaves_like
'it should not have Gmail Actions links'
it_behaves_like
"a user cannot unsubscribe through footer link"
it
'has the correct subject and body'
do
is_expected
.
to
have_subject
(
"
#{
project
.
name
}
| Mirror user changed"
)
is_expected
.
to
have_body_text
(
project
.
full_path
)
end
end
describe
'admin notification'
do
let
(
:example_site_path
)
{
root_path
}
let
(
:user
)
{
create
(
:user
)
}
subject
{
@email
=
described_class
.
send_admin_notification
(
user
.
id
,
'Admin announcement'
,
'Text'
)
}
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
expect
(
sender
.
display_name
).
to
eq
(
"GitLab"
)
expect
(
sender
.
address
).
to
eq
(
gitlab_sender
)
end
it
'is sent to recipient'
do
is_expected
.
to
deliver_to
user
.
email
end
it
'has the correct subject'
do
is_expected
.
to
have_subject
'Admin announcement'
end
it
'includes unsubscribe link'
do
unsubscribe_link
=
"http://localhost/unsubscribes/
#{
Base64
.
urlsafe_encode64
(
user
.
email
)
}
"
is_expected
.
to
have_body_text
(
unsubscribe_link
)
end
end
end
spec/mailers/notify_spec.rb
View file @
f709e99f
...
...
@@ -1359,65 +1359,6 @@ describe Notify do
end
end
describe
'mirror was hard failed'
do
let
(
:project
)
{
create
(
:project
,
:mirror
,
:import_hard_failed
)
}
subject
{
described_class
.
mirror_was_hard_failed_email
(
project
.
id
,
user
.
id
)
}
it_behaves_like
'an email sent from GitLab'
it_behaves_like
'it should not have Gmail Actions links'
it_behaves_like
"a user cannot unsubscribe through footer link"
it
'has the correct subject and body'
do
is_expected
.
to
have_subject
(
"
#{
project
.
name
}
| Repository mirroring paused"
)
is_expected
.
to
have_body_text
(
project
.
full_path
)
is_expected
.
to
have_body_text
(
project_settings_repository_url
(
project
))
end
end
describe
'mirror user changed'
do
let
(
:mirror_user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:mirror
,
mirror_user_id:
mirror_user
.
id
)
}
let
(
:new_mirror_user
)
{
project
.
team
.
owners
.
first
}
subject
{
described_class
.
project_mirror_user_changed_email
(
new_mirror_user
.
id
,
mirror_user
.
name
,
project
.
id
)
}
it_behaves_like
'an email sent from GitLab'
it_behaves_like
'it should not have Gmail Actions links'
it_behaves_like
"a user cannot unsubscribe through footer link"
it
'has the correct subject and body'
do
is_expected
.
to
have_subject
(
"
#{
project
.
name
}
| Mirror user changed"
)
is_expected
.
to
have_body_text
(
project
.
full_path
)
end
end
describe
'admin notification'
do
let
(
:example_site_path
)
{
root_path
}
let
(
:user
)
{
create
(
:user
)
}
subject
{
@email
=
described_class
.
send_admin_notification
(
user
.
id
,
'Admin announcement'
,
'Text'
)
}
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
expect
(
sender
.
display_name
).
to
eq
(
"GitLab"
)
expect
(
sender
.
address
).
to
eq
(
gitlab_sender
)
end
it
'is sent to recipient'
do
is_expected
.
to
deliver_to
user
.
email
end
it
'has the correct subject'
do
is_expected
.
to
have_subject
'Admin announcement'
end
it
'includes unsubscribe link'
do
unsubscribe_link
=
"http://localhost/unsubscribes/
#{
Base64
.
urlsafe_encode64
(
user
.
email
)
}
"
is_expected
.
to
have_body_text
(
unsubscribe_link
)
end
end
describe
'HTML emails setting'
do
let
(
:multipart_mail
)
{
described_class
.
project_was_moved_email
(
project
.
id
,
user
.
id
,
"gitlab/gitlab"
)
}
...
...
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