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
Jérome Perrin
gitlab-ce
Commits
264171f7
Commit
264171f7
authored
Dec 04, 2017
by
Francisco Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug
parent
7f2b6b11
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
+17
-2
app/services/projects/count_service.rb
app/services/projects/count_service.rb
+7
-0
spec/services/projects/count_service_spec.rb
spec/services/projects/count_service_spec.rb
+10
-2
No files found.
app/services/projects/count_service.rb
View file @
264171f7
...
@@ -25,5 +25,12 @@ module Projects
...
@@ -25,5 +25,12 @@ module Projects
def
cache_key
def
cache_key
[
'projects'
,
'count_service'
,
VERSION
,
@project
.
id
,
cache_key_name
]
[
'projects'
,
'count_service'
,
VERSION
,
@project
.
id
,
cache_key_name
]
end
end
def
self
.
query
(
project_ids
)
raise
(
NotImplementedError
,
'"query" must be implemented and return an ActiveRecord::Relation'
)
end
end
end
end
end
spec/services/projects/count_service_spec.rb
View file @
264171f7
...
@@ -4,9 +4,17 @@ describe Projects::CountService do
...
@@ -4,9 +4,17 @@ describe Projects::CountService do
let
(
:project
)
{
build
(
:project
,
id:
1
)
}
let
(
:project
)
{
build
(
:project
,
id:
1
)
}
let
(
:service
)
{
described_class
.
new
(
project
)
}
let
(
:service
)
{
described_class
.
new
(
project
)
}
describe
'
#relation_for_count
'
do
describe
'
.query
'
do
it
'raises NotImplementedError'
do
it
'raises NotImplementedError'
do
expect
{
service
.
relation_for_count
}.
to
raise_error
(
NotImplementedError
)
expect
{
described_class
.
query
(
project
.
id
)
}.
to
raise_error
(
NotImplementedError
)
end
end
describe
'#relation_for_count'
do
it
'calls the class method query with the project id'
do
expect
(
described_class
).
to
receive
(
:query
).
with
(
project
.
id
)
service
.
relation_for_count
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