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
eb525849
Commit
eb525849
authored
Feb 21, 2020
by
Robert May
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjust spec style, check author name
parent
32ece4b1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
11 deletions
+13
-11
spec/features/commits_spec.rb
spec/features/commits_spec.rb
+8
-7
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+5
-4
No files found.
spec/features/commits_spec.rb
View file @
eb525849
...
@@ -185,19 +185,20 @@ describe 'Commits' do
...
@@ -185,19 +185,20 @@ describe 'Commits' do
end
end
context
'viewing commits for an author'
do
context
'viewing commits for an author'
do
let
(
:author_commit
)
{
project
.
repository
.
commits
(
nil
,
limit:
1
).
first
}
let
(
:author
)
{
"
#{
author_commit
.
author_name
}
<
#{
author_commit
.
author_email
}
>"
}
let
(
:commits
)
{
project
.
repository
.
commits
(
nil
,
author:
author
,
limit:
40
)
}
before
do
before
do
project
.
add_maintainer
(
user
)
project
.
add_maintainer
(
user
)
sign_in
(
user
)
sign_in
(
user
)
visit
project_commits_path
(
project
,
nil
,
author:
author
)
end
end
it
'includes the committed_date for each commit'
do
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
)
visit
project_commits_path
(
project
,
nil
,
author:
author
)
commits
.
each
do
|
commit
|
commits
.
each
do
|
commit
|
expect
(
page
).
to
have_content
(
"authored
#{
commit
.
authored_date
.
strftime
(
"%b %d, %Y"
)
}
"
)
expect
(
page
).
to
have_content
(
"
#{
author_commit
.
author_name
}
authored
#{
commit
.
authored_date
.
strftime
(
"%b %d, %Y"
)
}
"
)
end
end
end
end
end
end
...
...
spec/models/repository_spec.rb
View file @
eb525849
...
@@ -321,15 +321,16 @@ describe Repository do
...
@@ -321,15 +321,16 @@ describe Repository do
end
end
context
"when 'author' is set"
do
context
"when 'author' is set"
do
let
(
:commit
)
{
repository
.
commits
(
nil
,
limit:
1
).
first
}
let
(
:known_author
)
{
"
#{
commit
.
author_name
}
<
#{
commit
.
author_email
}
>"
}
let
(
:unknown_author
)
{
"The Man With No Name <zapp@brannigan.com>"
}
it
"returns commits from that author"
do
it
"returns commits from that author"
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
).
size
).
to
be
>
0
end
end
it
"doesn't returns commits from an unknown author"
do
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
).
size
).
to
eq
(
0
)
end
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