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
4b5dbf33
Commit
4b5dbf33
authored
Dec 16, 2021
by
Jason Goodman
Committed by
Heinrich Lee Yu
Dec 16, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clarify Specs for Namespace#billable_members_count
parent
bfafb1c8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
21 deletions
+25
-21
ee/spec/models/ee/namespace_spec.rb
ee/spec/models/ee/namespace_spec.rb
+25
-21
No files found.
ee/spec/models/ee/namespace_spec.rb
View file @
4b5dbf33
...
@@ -1170,16 +1170,16 @@ RSpec.describe Namespace do
...
@@ -1170,16 +1170,16 @@ RSpec.describe Namespace do
group
.
add_guest
(
create
(
:user
))
group
.
add_guest
(
create
(
:user
))
end
end
context
'with a ultimate plan'
do
context
'with a
n
ultimate plan'
do
before
do
before
do
create
(
:gitlab_subscription
,
namespace:
group
,
hosted_plan:
ultimate_plan
)
create
(
:gitlab_subscription
,
namespace:
group
,
hosted_plan:
ultimate_plan
)
end
end
it
'
does not count guest users and counts only active users
'
do
it
'
counts only active users with an access level higher than guest
'
do
expect
(
group
.
billable_members_count
).
to
eq
(
1
)
expect
(
group
.
billable_members_count
).
to
eq
(
1
)
end
end
context
'when group has a project
and users invited to it
'
do
context
'when group has a project
with invited users
'
do
let
(
:project
)
{
create
(
:project
,
namespace:
group
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
group
)
}
before
do
before
do
...
@@ -1189,17 +1189,19 @@ RSpec.describe Namespace do
...
@@ -1189,17 +1189,19 @@ RSpec.describe Namespace do
project
.
add_developer
(
create
(
:user
,
:blocked
))
project
.
add_developer
(
create
(
:user
,
:blocked
))
end
end
it
'includes invited active users except guests
to the group
'
do
it
'includes invited active users except guests'
do
expect
(
group
.
billable_members_count
).
to
eq
(
2
)
expect
(
group
.
billable_members_count
).
to
eq
(
2
)
end
end
context
'with project bot users'
do
context
'with project bot users'
do
include_context
'project bot users'
include_context
'project bot users'
it
{
expect
(
group
.
billable_members_count
).
to
eq
(
2
)
}
it
'does not include project bot users in the count'
do
expect
(
group
.
billable_members_count
).
to
eq
(
2
)
end
end
end
context
'when group is invited to the project'
do
context
'when
another
group is invited to the project'
do
let
(
:invited_group
)
{
create
(
:group
)
}
let
(
:invited_group
)
{
create
(
:group
)
}
before
do
before
do
...
@@ -1210,25 +1212,25 @@ RSpec.describe Namespace do
...
@@ -1210,25 +1212,25 @@ RSpec.describe Namespace do
create
(
:project_group_link
,
project:
project
,
group:
invited_group
)
create
(
:project_group_link
,
project:
project
,
group:
invited_group
)
end
end
it
'
counts the only active users except guests of the invited groups
'
do
it
'
includes active users in the invited group with an access level higher than guest
'
do
expect
(
group
.
billable_members_count
).
to
eq
(
3
)
expect
(
group
.
billable_members_count
).
to
eq
(
3
)
end
end
end
end
end
end
context
'when group has been shared with another group'
do
context
'when group has been shared with another group'
do
let
(
:
shared
_group
)
{
create
(
:group
)
}
let
(
:
other
_group
)
{
create
(
:group
)
}
before
do
before
do
shared
_group
.
add_developer
(
create
(
:user
))
other
_group
.
add_developer
(
create
(
:user
))
shared
_group
.
add_guest
(
create
(
:user
))
other
_group
.
add_guest
(
create
(
:user
))
shared
_group
.
add_developer
(
create
(
:user
,
:blocked
))
other
_group
.
add_developer
(
create
(
:user
,
:blocked
))
create
(
:group_group_link
,
{
shared_with_group:
shared
_group
,
create
(
:group_group_link
,
{
shared_with_group:
other
_group
,
shared_group:
group
})
shared_group:
group
})
end
end
it
'includes active users from the
shared group to
the billed members count'
do
it
'includes active users from the
other group in
the billed members count'
do
expect
(
group
.
billable_members_count
).
to
eq
(
2
)
expect
(
group
.
billable_members_count
).
to
eq
(
2
)
end
end
end
end
...
@@ -1259,10 +1261,12 @@ RSpec.describe Namespace do
...
@@ -1259,10 +1261,12 @@ RSpec.describe Namespace do
context
'with project bot users'
do
context
'with project bot users'
do
include_context
'project bot users'
include_context
'project bot users'
it
{
expect
(
group
.
billable_members_count
).
to
eq
(
4
)
}
it
'does not include project bot users in the count'
do
expect
(
group
.
billable_members_count
).
to
eq
(
4
)
end
end
end
context
'when group is invited to the project'
do
context
'when
another
group is invited to the project'
do
let
(
:invited_group
)
{
create
(
:group
)
}
let
(
:invited_group
)
{
create
(
:group
)
}
before
do
before
do
...
@@ -1280,19 +1284,19 @@ RSpec.describe Namespace do
...
@@ -1280,19 +1284,19 @@ RSpec.describe Namespace do
end
end
context
'when group has been shared with another group'
do
context
'when group has been shared with another group'
do
let
(
:
shared
_group
)
{
create
(
:group
)
}
let
(
:
other
_group
)
{
create
(
:group
)
}
before
do
before
do
create
(
:gitlab_subscription
,
namespace:
group
,
hosted_plan:
send
(
plan
))
create
(
:gitlab_subscription
,
namespace:
group
,
hosted_plan:
send
(
plan
))
shared
_group
.
add_developer
(
create
(
:user
))
other
_group
.
add_developer
(
create
(
:user
))
shared
_group
.
add_guest
(
create
(
:user
))
other
_group
.
add_guest
(
create
(
:user
))
shared
_group
.
add_developer
(
create
(
:user
,
:blocked
))
other
_group
.
add_developer
(
create
(
:user
,
:blocked
))
create
(
:group_group_link
,
{
shared_with_group:
shared
_group
,
create
(
:group_group_link
,
{
shared_with_group:
other
_group
,
shared_group:
group
})
shared_group:
group
})
end
end
it
'includes active users from the
shared group including guests to
the billed members count'
do
it
'includes active users from the
other group including guests in
the billed members count'
do
expect
(
group
.
billable_members_count
).
to
eq
(
4
)
expect
(
group
.
billable_members_count
).
to
eq
(
4
)
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