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
0a002e23
Commit
0a002e23
authored
Dec 22, 2017
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement ResetProjectCacheService
parent
f58cc2ee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
+19
-2
app/services/reset_project_cache_service.rb
app/services/reset_project_cache_service.rb
+1
-0
spec/services/reset_project_cache_service_spec.rb
spec/services/reset_project_cache_service_spec.rb
+18
-2
No files found.
app/services/reset_project_cache_service.rb
View file @
0a002e23
class
ResetProjectCacheService
<
BaseService
def
execute
@project
.
increment!
(
:cache_index
)
end
end
spec/services/reset_project_cache_service_spec.rb
View file @
0a002e23
...
...
@@ -6,7 +6,23 @@ describe ResetProjectCacheService do
subject
{
described_class
.
new
(
project
,
user
).
execute
}
it
"resets project cache"
do
fail
context
'when project cache_index is nil'
do
before
do
project
.
cache_index
=
nil
end
it
'sets project cache_index to one'
do
expect
{
subject
}.
to
change
{
project
.
reload
.
cache_index
}.
from
(
nil
).
to
(
1
)
end
end
context
'when project cache_index is a numeric value'
do
before
do
project
.
update_attributes
(
cache_index:
1
)
end
it
'increments project cache index'
do
expect
{
subject
}.
to
change
{
project
.
reload
.
cache_index
}.
by
(
1
)
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