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
0
Merge Requests
0
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
Tatuya Kamada
gitlab-ce
Commits
56e06b03
Commit
56e06b03
authored
May 13, 2015
by
Vinnie Okada
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for password reset token changes
parent
af428b12
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
33 deletions
+24
-33
spec/mailers/notify_spec.rb
spec/mailers/notify_spec.rb
+24
-33
No files found.
spec/mailers/notify_spec.rb
View file @
56e06b03
...
...
@@ -5,6 +5,8 @@ describe Notify do
include
EmailSpec
::
Matchers
include
RepoHelpers
new_user_address
=
'newguy@example.com'
let
(
:gitlab_sender_display_name
)
{
Gitlab
.
config
.
gitlab
.
email_display_name
}
let
(
:gitlab_sender
)
{
Gitlab
.
config
.
gitlab
.
email_from
}
let
(
:gitlab_sender_reply_to
)
{
Gitlab
.
config
.
gitlab
.
email_reply_to
}
...
...
@@ -55,18 +57,9 @@ describe Notify do
end
end
describe
'for new users, the email'
do
let
(
:example_site_path
)
{
root_path
}
let
(
:new_user
)
{
create
(
:user
,
email:
'newguy@example.com'
,
created_by_id:
1
)
}
token
=
'kETLwRaayvigPq_x3SNM'
subject
{
Notify
.
new_user_email
(
new_user
.
id
,
token
)
}
it_behaves_like
'an email sent from GitLab'
shared_examples
'a new user email'
do
|
user_email
,
site_path
|
it
'is sent to the new user'
do
is_expected
.
to
deliver_to
new_user
.
email
is_expected
.
to
deliver_to
user_
email
end
it
'has the correct subject'
do
...
...
@@ -74,9 +67,25 @@ describe Notify do
end
it
'contains the new user\'s login name'
do
is_expected
.
to
have_body_text
/
#{
new_user
.
email
}
/
is_expected
.
to
have_body_text
/
#{
user_
email
}
/
end
it
'includes a link to the site'
do
is_expected
.
to
have_body_text
/
#{
site_path
}
/
end
end
describe
'for new users, the email'
do
let
(
:example_site_path
)
{
root_path
}
let
(
:new_user
)
{
create
(
:user
,
email:
new_user_address
,
created_by_id:
1
)
}
token
=
'kETLwRaayvigPq_x3SNM'
subject
{
Notify
.
new_user_email
(
new_user
.
id
,
token
)
}
it_behaves_like
'an email sent from GitLab'
it_behaves_like
'a new user email'
,
new_user_address
it
'contains the password text'
do
is_expected
.
to
have_body_text
/Click here to set your password/
end
...
...
@@ -88,44 +97,26 @@ describe Notify do
)
end
it
'includes a link to the site'
do
is_expected
.
to
have_body_text
/
#{
example_site_path
}
/
end
it
'explains the reset link expiration'
do
is_expected
.
to
have_body_text
(
/This link is valid for \d+ (hours?|days?)/
)
is_expected
.
to
have_body_text
(
new_user_password_url
)
is_expected
.
to
have_body_text
(
/\?user_email=.*%40.*/
)
end
end
describe
'for users that signed up, the email'
do
let
(
:example_site_path
)
{
root_path
}
let
(
:new_user
)
{
create
(
:user
,
email:
'newguy@example.com'
,
password:
"securePassword"
)
}
let
(
:new_user
)
{
create
(
:user
,
email:
new_user_address
,
password:
"securePassword"
)
}
subject
{
Notify
.
new_user_email
(
new_user
.
id
)
}
it_behaves_like
'an email sent from GitLab'
it
'is sent to the new user'
do
is_expected
.
to
deliver_to
new_user
.
email
end
it
'has the correct subject'
do
is_expected
.
to
have_subject
/^Account was created for you$/i
end
it
'contains the new user\'s login name'
do
is_expected
.
to
have_body_text
/
#{
new_user
.
email
}
/
end
it_behaves_like
'a new user email'
,
new_user_address
it
'should not contain the new user\'s password'
do
is_expected
.
not_to
have_body_text
/password/
end
it
'includes a link to the site'
do
is_expected
.
to
have_body_text
/
#{
example_site_path
}
/
end
end
describe
'user added ssh key'
do
...
...
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