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
cc704112
Commit
cc704112
authored
Aug 29, 2019
by
Yuping Zuo
Committed by
Nick Thomas
Aug 29, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: show preferred commit email in empty project page
parent
5db02773
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
1 deletion
+37
-1
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+1
-1
spec/helpers/projects_helper_spec.rb
spec/helpers/projects_helper_spec.rb
+36
-0
No files found.
app/helpers/projects_helper.rb
View file @
cc704112
...
...
@@ -448,7 +448,7 @@ module ProjectsHelper
def
git_user_email
if
current_user
current_user
.
email
current_user
.
commit_
email
else
"your@email.com"
end
...
...
spec/helpers/projects_helper_spec.rb
View file @
cc704112
...
...
@@ -549,6 +549,42 @@ describe ProjectsHelper do
end
end
describe
'#git_user_email'
do
context
'not logged-in'
do
before
do
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
nil
)
end
it
'returns your@email.com'
do
expect
(
helper
.
send
(
:git_user_email
)).
to
eq
(
'your@email.com'
)
end
end
context
'user logged in'
do
let
(
:user
)
{
create
(
:user
)
}
before
do
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
user
)
end
context
'user has no configured commit email'
do
it
'returns the primary email'
do
expect
(
helper
.
send
(
:git_user_email
)).
to
eq
(
user
.
email
)
end
end
context
'user has a configured commit email'
do
before
do
confirmed_email
=
create
(
:email
,
:confirmed
,
user:
user
)
user
.
update
(
commit_email:
confirmed_email
)
end
it
'returns the commit email'
do
expect
(
helper
.
send
(
:git_user_email
)).
to
eq
(
user
.
commit_email
)
end
end
end
end
describe
'show_xcode_link'
do
let!
(
:project
)
{
create
(
:project
)
}
let
(
:mac_ua
)
{
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36'
}
...
...
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