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
68d6a2a2
Commit
68d6a2a2
authored
Dec 27, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Project#repository_and_lfs_size after removing repository_size method
parent
832ea8a8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
2 deletions
+10
-2
app/models/project.rb
app/models/project.rb
+1
-1
spec/lib/gitlab/repository_size_error_spec.rb
spec/lib/gitlab/repository_size_error_spec.rb
+4
-1
spec/models/project_spec.rb
spec/models/project_spec.rb
+5
-0
No files found.
app/models/project.rb
View file @
68d6a2a2
...
@@ -1507,7 +1507,7 @@ class Project < ActiveRecord::Base
...
@@ -1507,7 +1507,7 @@ class Project < ActiveRecord::Base
end
end
def
repository_and_lfs_size
def
repository_and_lfs_size
repository_size
+
lfs_objects
.
sum
(
:size
).
to_i
.
to_mb
statistics
.
storage_size
+
statistics
.
lfs_objects_size
end
end
def
above_size_limit?
def
above_size_limit?
...
...
spec/lib/gitlab/repository_size_error_spec.rb
View file @
68d6a2a2
require
'spec_helper'
require
'spec_helper'
describe
Gitlab
::
RepositorySizeError
,
lib:
true
do
describe
Gitlab
::
RepositorySizeError
,
lib:
true
do
let
(
:project
)
{
create
(
:empty_project
,
repository_size:
15
)
}
let
(
:project
)
do
create
(
:empty_project
,
statistics:
build
(
:project_statistics
,
repository_size:
15
))
end
let
(
:message
)
{
Gitlab
::
RepositorySizeError
.
new
(
project
)
}
let
(
:message
)
{
Gitlab
::
RepositorySizeError
.
new
(
project
)
}
let
(
:base_message
)
{
'because this repository has exceeded its size limit of 10 MB by 5 MB'
}
let
(
:base_message
)
{
'because this repository has exceeded its size limit of 10 MB by 5 MB'
}
...
...
spec/models/project_spec.rb
View file @
68d6a2a2
...
@@ -588,6 +588,11 @@ describe Project, models: true do
...
@@ -588,6 +588,11 @@ describe Project, models: true do
end
end
describe
'#above_size_limit?'
do
describe
'#above_size_limit?'
do
let
(
:project
)
do
create
(
:empty_project
,
statistics:
build
(
:project_statistics
))
end
it
'returns true when above the limit'
do
it
'returns true when above the limit'
do
allow
(
project
).
to
receive
(
:repository_and_lfs_size
).
and_return
(
100
)
allow
(
project
).
to
receive
(
:repository_and_lfs_size
).
and_return
(
100
)
...
...
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