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
c4d6329b
Commit
c4d6329b
authored
Aug 19, 2021
by
Doug Stull
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test coverage for project member list page
- needed before refactoring
parent
3e47ccc6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
245 additions
and
0 deletions
+245
-0
ee/spec/views/projects/project_members/index.html.haml_spec.rb
...ec/views/projects/project_members/index.html.haml_spec.rb
+81
-0
spec/views/groups/group_members/index.html.haml_spec.rb
spec/views/groups/group_members/index.html.haml_spec.rb
+68
-0
spec/views/projects/project_members/index.html.haml_spec.rb
spec/views/projects/project_members/index.html.haml_spec.rb
+96
-0
No files found.
ee/spec/views/projects/project_members/index.html.haml_spec.rb
0 → 100644
View file @
c4d6329b
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
'projects/project_members/index'
,
:aggregate_failures
do
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:project
)
{
ProjectPresenter
.
new
(
create
(
:project
,
:empty_repo
),
current_user:
user
)
}
before
do
allow
(
view
).
to
receive
(
:project_members_app_data_json
).
and_return
({})
allow
(
view
).
to
receive
(
:current_user
).
and_return
(
user
)
assign
(
:project
,
project
)
end
context
'when user can invite members for the project'
do
before
do
project
.
add_maintainer
(
user
)
end
context
'when membership is locked'
do
before
do
allow
(
view
).
to
receive
(
:membership_locked?
).
and_return
(
true
)
end
it
'renders as expected'
do
render
expect
(
rendered
).
to
have_content
(
'Project members'
)
expect
(
rendered
).
to
have_content
(
'You can invite another group to'
)
expect
(
rendered
).
not_to
have_link
(
'Import a project'
)
expect
(
rendered
).
to
have_selector
(
'.js-invite-group-trigger'
)
expect
(
rendered
).
not_to
have_selector
(
'.js-invite-members-trigger'
)
expect
(
rendered
).
not_to
have_content
(
'Members can be added by project'
)
expect
(
response
).
to
render_template
(
partial:
'projects/_invite_members_modal'
)
end
context
'when project can not be shared'
do
before
do
project
.
namespace
.
share_with_group_lock
=
true
end
it
'renders as expected'
do
render
expect
(
rendered
).
to
have_content
(
'Project members'
)
expect
(
rendered
).
not_to
have_content
(
'You can invite'
)
expect
(
response
).
to
render_template
(
partial:
'projects/_invite_members_modal'
)
end
context
'when modal is not enabled'
do
before
do
stub_feature_flags
(
invite_members_group_modal:
false
)
end
it
'renders as expected'
do
render
expect
(
rendered
).
not_to
have_content
(
'Project members'
)
expect
(
response
).
not_to
render_template
(
partial:
'projects/_invite_members_modal'
)
end
end
end
end
end
context
'when user can not invite members or group for the project'
do
context
'when membership is locked and project can not be shared'
do
before
do
allow
(
view
).
to
receive
(
:membership_locked?
).
and_return
(
true
)
project
.
namespace
.
share_with_group_lock
=
true
end
it
'renders as expected'
do
render
expect
(
rendered
).
not_to
have_content
(
'Project members'
)
expect
(
rendered
).
not_to
have_content
(
'Members can be added by project'
)
end
end
end
end
spec/views/groups/group_members/index.html.haml_spec.rb
0 → 100644
View file @
c4d6329b
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
'groups/group_members/index'
,
:aggregate_failures
do
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:group
)
{
create
(
:group
)
}
before
do
allow
(
view
).
to
receive
(
:group_members_app_data
).
and_return
({})
allow
(
view
).
to
receive
(
:current_user
).
and_return
(
user
)
assign
(
:group
,
group
)
assign
(
:group_member
,
build
(
:group_member
,
group:
group
))
end
context
'when user can invite members for the group'
do
before
do
group
.
add_owner
(
user
)
end
context
'when modal is enabled'
do
it
'renders as expected'
do
render
expect
(
rendered
).
to
have_content
(
'Group members'
)
expect
(
rendered
).
to
have_content
(
'You can invite a new member'
)
expect
(
rendered
).
to
have_selector
(
'.js-invite-group-trigger'
)
expect
(
rendered
).
to
have_selector
(
'.js-invite-members-trigger'
)
expect
(
response
).
to
render_template
(
partial:
'groups/_invite_members_modal'
)
expect
(
rendered
).
not_to
have_selector
(
'#invite-member-tab'
)
expect
(
rendered
).
not_to
have_selector
(
'#invite-group-tab'
)
expect
(
response
).
not_to
render_template
(
partial:
'shared/members/_invite_group'
)
end
end
context
'when modal is not enabled'
do
before
do
stub_feature_flags
(
invite_members_group_modal:
false
)
end
it
'renders as expected'
do
render
expect
(
rendered
).
to
have_content
(
'Group members'
)
expect
(
rendered
).
to
have_content
(
'You can invite a new member'
)
expect
(
rendered
).
to
have_selector
(
'#invite-member-tab'
)
expect
(
rendered
).
to
have_selector
(
'#invite-group-tab'
)
expect
(
response
).
to
render_template
(
partial:
'shared/members/_invite_group'
)
expect
(
rendered
).
not_to
have_selector
(
'.js-invite-group-trigger'
)
expect
(
rendered
).
not_to
have_selector
(
'.js-invite-members-trigger'
)
expect
(
response
).
not_to
render_template
(
partial:
'groups/_invite_members_modal'
)
end
end
end
context
'when user can not invite members for the group'
do
it
'renders as expected'
,
:aggregate_failures
do
render
expect
(
rendered
).
not_to
have_content
(
'Group members'
)
expect
(
rendered
).
not_to
have_content
(
'You can invite a new member'
)
end
end
end
spec/views/projects/project_members/index.html.haml_spec.rb
0 → 100644
View file @
c4d6329b
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
'projects/project_members/index'
,
:aggregate_failures
do
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:source
)
{
create
(
:project
,
:empty_repo
)
}
let_it_be
(
:project
)
{
ProjectPresenter
.
new
(
source
,
current_user:
user
)
}
before
do
allow
(
view
).
to
receive
(
:project_members_app_data_json
).
and_return
({})
allow
(
view
).
to
receive
(
:current_user
).
and_return
(
user
)
assign
(
:project
,
project
)
assign
(
:project_member
,
build
(
:project_member
,
project:
source
))
end
context
'when user can invite members for the project'
do
before
do
project
.
add_maintainer
(
user
)
end
context
'when modal is enabled'
do
it
'renders as expected'
do
render
expect
(
rendered
).
to
have_content
(
'Project members'
)
expect
(
rendered
).
to
have_content
(
'You can invite a new member'
)
expect
(
rendered
).
to
have_link
(
'Import a project'
)
expect
(
rendered
).
to
have_selector
(
'.js-invite-group-trigger'
)
expect
(
rendered
).
to
have_selector
(
'.js-invite-members-trigger'
)
expect
(
rendered
).
not_to
have_content
(
'Members can be added by project'
)
expect
(
response
).
to
render_template
(
partial:
'projects/_invite_members_modal'
)
end
context
'when project is not allowed to share with group'
do
before
do
project
.
namespace
.
share_with_group_lock
=
true
end
it
'renders as expected'
do
render
expect
(
rendered
).
not_to
have_selector
(
'.js-invite-group-trigger'
)
end
end
end
context
'when modal is not enabled'
do
before
do
stub_feature_flags
(
invite_members_group_modal:
false
)
end
it
'renders as expected'
do
render
expect
(
rendered
).
to
have_content
(
'Project members'
)
expect
(
rendered
).
to
have_content
(
'You can invite a new member'
)
expect
(
rendered
).
not_to
have_selector
(
'.js-invite-group-trigger'
)
expect
(
rendered
).
not_to
have_selector
(
'.js-invite-members-trigger'
)
expect
(
rendered
).
not_to
have_content
(
'Members can be added by project'
)
expect
(
response
).
not_to
render_template
(
partial:
'projects/_invite_members_modal'
)
expect
(
response
).
to
render_template
(
partial:
'shared/members/_invite_member'
)
end
context
'when project can not be shared'
do
before
do
project
.
namespace
.
share_with_group_lock
=
true
end
it
'renders as expected'
do
render
expect
(
rendered
).
to
have_content
(
'Project members'
)
expect
(
rendered
).
to
have_content
(
'You can invite a new member'
)
expect
(
response
).
not_to
render_template
(
partial:
'projects/_invite_members_modal'
)
end
end
end
end
context
'when user can not invite members or group for the project'
do
context
'when project can be shared'
do
it
'renders as expected'
,
:aggregate_failures
do
render
expect
(
rendered
).
to
have_content
(
'Project members'
)
expect
(
rendered
).
not_to
have_content
(
'You can invite a new member'
)
expect
(
rendered
).
not_to
have_link
(
'Import a project'
)
expect
(
rendered
).
not_to
have_selector
(
'.js-invite-group-trigger'
)
expect
(
rendered
).
not_to
have_selector
(
'.js-invite-members-trigger'
)
expect
(
rendered
).
to
have_content
(
'Members can be added by project'
)
expect
(
response
).
not_to
render_template
(
partial:
'projects/_invite_members_modal'
)
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