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
Léo-Paul Géneau
gitlab-ce
Commits
8a0226d4
Commit
8a0226d4
authored
May 29, 2019
by
Peter Marko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add spec to verify statistics without repositories
parent
40490cc4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
+38
-0
spec/models/project_statistics_spec.rb
spec/models/project_statistics_spec.rb
+38
-0
No files found.
spec/models/project_statistics_spec.rb
View file @
8a0226d4
...
...
@@ -83,6 +83,44 @@ describe ProjectStatistics do
expect
(
statistics
).
not_to
have_received
(
:update_wiki_size
)
end
end
context
'without repositories'
do
it
'does not crash'
do
expect
(
project
.
repository
.
exists?
).
to
be_falsey
expect
(
project
.
wiki
.
repository
.
exists?
).
to
be_falsey
statistics
.
refresh!
expect
(
statistics
).
to
have_received
(
:update_commit_count
)
expect
(
statistics
).
to
have_received
(
:update_repository_size
)
expect
(
statistics
).
to
have_received
(
:update_wiki_size
)
expect
(
statistics
.
repository_size
).
to
eq
(
0
)
expect
(
statistics
.
commit_count
).
to
eq
(
0
)
expect
(
statistics
.
wiki_size
).
to
eq
(
0
)
end
end
context
'with deleted repositories'
do
let
(
:project
)
{
create
(
:project
,
:repository
,
:wiki_repo
)
}
before
do
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
FileUtils
.
rm_rf
(
project
.
repository
.
path
)
FileUtils
.
rm_rf
(
project
.
wiki
.
repository
.
path
)
end
end
it
'does not crash'
do
statistics
.
refresh!
expect
(
statistics
).
to
have_received
(
:update_commit_count
)
expect
(
statistics
).
to
have_received
(
:update_repository_size
)
expect
(
statistics
).
to
have_received
(
:update_wiki_size
)
expect
(
statistics
.
repository_size
).
to
eq
(
0
)
expect
(
statistics
.
commit_count
).
to
eq
(
0
)
expect
(
statistics
.
wiki_size
).
to
eq
(
0
)
end
end
end
describe
'#update_commit_count'
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