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
60a41a5b
Commit
60a41a5b
authored
Feb 16, 2018
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add more tests to users stats feature
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
d31477f1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
14 deletions
+33
-14
ee/spec/models/ee/project_authorization_spec.rb
ee/spec/models/ee/project_authorization_spec.rb
+27
-0
spec/ee/spec/features/admin/admin_dashboard_spec.rb
spec/ee/spec/features/admin/admin_dashboard_spec.rb
+6
-14
No files found.
ee/spec/models/ee/project_authorization_spec.rb
0 → 100644
View file @
60a41a5b
require
'spec_helper'
describe
ProjectAuthorization
do
describe
'.roles_stats'
do
before
do
project1
=
create
(
:project_empty_repo
)
project1
.
add_reporter
(
create
(
:user
))
project2
=
create
(
:project_empty_repo
)
project2
.
add_developer
(
create
(
:user
))
# Add same user as Reporter and Developer to different projects
# and expect it to be counted once for the stats
user
=
create
(
:user
)
project1
.
add_reporter
(
user
)
project2
.
add_developer
(
user
)
end
subject
{
ProjectAuthorization
.
roles_stats
.
to_a
}
it
do
expect
(
subject
).
to
include
({
'kind'
=>
'reporter'
,
'amount'
=>
'1'
})
expect
(
subject
).
to
include
({
'kind'
=>
'developer'
,
'amount'
=>
'2'
})
expect
(
subject
).
to
include
({
'kind'
=>
'master'
,
'amount'
=>
'2'
})
end
end
end
spec/ee/spec/features/admin/admin_dashboard_spec.rb
View file @
60a41a5b
...
...
@@ -3,23 +3,15 @@ require 'spec_helper'
describe
'Admin Dashboard'
do
describe
'Users statistic'
do
before
do
3
.
times
do
project
=
create
(
:project
)
user
=
create
(
:user
)
project
.
add_reporter
(
user
)
end
project1
=
create
(
:project_empty_repo
)
project1
.
add_reporter
(
create
(
:user
))
2
.
times
do
project
=
create
(
:project
)
user
=
create
(
:user
)
project
.
add_developer
(
user
)
end
project2
=
create
(
:project_empty_repo
)
project2
.
add_developer
(
create
(
:user
))
# Add same user as Reporter and Developer to different projects
# and expect it to be counted once for the stats
user
=
create
(
:user
)
project1
=
Project
.
first
project2
=
Project
.
last
project1
.
add_reporter
(
user
)
project2
.
add_developer
(
user
)
...
...
@@ -31,8 +23,8 @@ describe 'Admin Dashboard' do
visit
admin_dashboard_stats_path
expect
(
page
).
to
have_content
(
'Admin users 1'
)
expect
(
page
).
to
have_content
(
'Users with highest role developer
3
'
)
expect
(
page
).
to
have_content
(
'Users with highest role reporter
3
'
)
expect
(
page
).
to
have_content
(
'Users with highest role developer
2
'
)
expect
(
page
).
to
have_content
(
'Users with highest role reporter
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