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
75c2e1a3
Commit
75c2e1a3
authored
Feb 26, 2020
by
Robert May
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates to the specs
parent
c7fbe3c4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
10 deletions
+28
-10
spec/features/commits_spec.rb
spec/features/commits_spec.rb
+26
-8
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+2
-2
No files found.
spec/features/commits_spec.rb
View file @
75c2e1a3
...
...
@@ -185,21 +185,39 @@ describe 'Commits' do
end
context
'viewing commits for an author'
do
let
(
:author_commit
)
{
project
.
repository
.
commits
(
nil
,
limit:
1
).
first
}
let
(
:commits
)
{
project
.
repository
.
commits
(
nil
,
author:
author
,
limit:
40
)
}
before
do
project
.
add_maintainer
(
user
)
sign_in
(
user
)
visit
project_commits_path
(
project
,
nil
,
author:
author
)
end
it
'includes the author name and committed_date for each commit'
do
author_commit
=
project
.
repository
.
commits
(
nil
,
limit:
1
).
first
author
=
"
#{
author_commit
.
author_name
}
<
#{
author_commit
.
author_email
}
>"
commits
=
project
.
repository
.
commits
(
nil
,
author:
author
,
limit:
40
)
shared_examples
'show commits by author'
do
it
"includes the author's commits"
do
commits
.
each
do
|
commit
|
expect
(
page
).
to
have_content
(
"
#{
author_commit
.
author_name
}
authored
#{
commit
.
authored_date
.
strftime
(
"%b %d, %Y"
)
}
"
)
end
end
end
visit
project_commits_path
(
project
,
nil
,
author:
author
)
context
'author is complete'
do
let
(
:author
)
{
"
#{
author_commit
.
author_name
}
<
#{
author_commit
.
author_email
}
>"
}
commits
.
each
do
|
commit
|
expect
(
page
).
to
have_content
(
"
#{
author_commit
.
author_name
}
authored
#{
commit
.
authored_date
.
strftime
(
"%b %d, %Y"
)
}
"
)
end
it_behaves_like
'show commits by author'
end
context
'author is just a name'
do
let
(
:author
)
{
"
#{
author_commit
.
author_name
}
"
}
it_behaves_like
'show commits by author'
end
context
'author is just an email'
do
let
(
:author
)
{
"
#{
author_commit
.
author_email
}
"
}
it_behaves_like
'show commits by author'
end
end
end
spec/models/repository_spec.rb
View file @
75c2e1a3
...
...
@@ -325,13 +325,13 @@ describe Repository do
commit
=
repository
.
commits
(
nil
,
limit:
1
).
first
known_author
=
"
#{
commit
.
author_name
}
<
#{
commit
.
author_email
}
>"
expect
(
repository
.
commits
(
nil
,
author:
known_author
,
limit:
1
)
.
size
).
to
be
>
0
expect
(
repository
.
commits
(
nil
,
author:
known_author
,
limit:
1
)
).
not_to
be_empty
end
it
"doesn't returns commits from an unknown author"
do
unknown_author
=
"The Man With No Name <zapp@brannigan.com>"
expect
(
repository
.
commits
(
nil
,
author:
unknown_author
,
limit:
1
)
.
size
).
to
eq
(
0
)
expect
(
repository
.
commits
(
nil
,
author:
unknown_author
,
limit:
1
)
).
to
be_empty
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