Commit 2ab8779d authored by manojmj's avatar manojmj

Remove `access_requestable ` trait from factories and specs

This change removes the usage of `access_requestable `
trait from factories and specs
parent d4c1886e
......@@ -3,6 +3,4 @@
.form-check
= form.check_box :request_access_enabled, class: 'form-check-input', data: { qa_selector: 'request_access_checkbox' }
= form.label :request_access_enabled, class: 'form-check-label' do
%span{ class: label_class }= _('Allow users to request access')
%br
%span.text-muted= _('Allow users to request access if visibility is public or internal.')
%span{ class: label_class }= _('Allow users to request access (if visibility is public or internal)')
......@@ -6,7 +6,7 @@ describe Groups::GroupMembersController do
include ExternalAuthorizationServiceHelpers
let(:user) { create(:user) }
let(:group) { create(:group, :public, :access_requestable) }
let(:group) { create(:group, :public) }
let(:membership) { create(:group_member, group: group) }
before do
......
......@@ -4,7 +4,7 @@ require('spec_helper')
describe Projects::ProjectMembersController do
let(:user) { create(:user) }
let(:project) { create(:project, :public, :access_requestable, namespace: namespace) }
let(:project) { create(:project, :public, namespace: namespace) }
let(:namespace) { create :group }
describe 'POST apply_import' do
......
......@@ -172,7 +172,6 @@ describe EE::Gitlab::Auth::LDAP::Sync::Group do
let(:group) do
create(:group_with_ldap_group_link,
:access_requestable,
cn: 'ldap_group1',
group_access: ::Gitlab::Access::DEVELOPER)
end
......@@ -388,7 +387,7 @@ describe EE::Gitlab::Auth::LDAP::Sync::Group do
end
context 'when user has a pending access request in a parent group' do
let(:parent_group) { create(:group, :access_requestable) }
let(:parent_group) { create(:group) }
let(:ldap_group1) { ldap_group_entry(user_dn(user.username)) }
let(:access_requester) { parent_group.request_access(user) }
before do
......@@ -578,7 +577,6 @@ describe EE::Gitlab::Auth::LDAP::Sync::Group do
describe '#update_permissions' do
let(:group) do
create(:group_with_ldap_group_filter_link,
:access_requestable,
group_access: ::Gitlab::Access::DEVELOPER)
end
let(:sync_group) { described_class.new(group, proxy(adapter)) }
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
describe Ci::Build do
set(:group) { create(:group, :access_requestable, plan: :bronze_plan) }
set(:group) { create(:group, plan: :bronze_plan) }
let(:project) { create(:project, :repository, group: group) }
let(:pipeline) do
......
......@@ -1413,10 +1413,7 @@ msgstr ""
msgid "Allow users to register any application to use GitLab as an OAuth provider"
msgstr ""
msgid "Allow users to request access"
msgstr ""
msgid "Allow users to request access if visibility is public or internal."
msgid "Allow users to request access (if visibility is public or internal)"
msgstr ""
msgid "Allowed email domain restriction only permitted for top-level groups"
......
......@@ -6,7 +6,7 @@ describe Groups::GroupMembersController do
include ExternalAuthorizationServiceHelpers
let(:user) { create(:user) }
let(:group) { create(:group, :public, :access_requestable) }
let(:group) { create(:group, :public) }
let(:membership) { create(:group_member, group: group) }
describe 'GET index' do
......
......@@ -4,7 +4,7 @@ require('spec_helper')
describe Projects::ProjectMembersController do
let(:user) { create(:user) }
let(:project) { create(:project, :public, :access_requestable) }
let(:project) { create(:project, :public) }
describe 'GET index' do
it 'has the project_members address with a 200 status code' do
......
......@@ -32,8 +32,8 @@ FactoryBot.define do
avatar { fixture_file_upload('spec/fixtures/dk.png') }
end
trait :access_requestable do
request_access_enabled { true }
trait :request_access_disabled do
request_access_enabled { false }
end
trait :nested do
......
......@@ -117,8 +117,8 @@ FactoryBot.define do
storage_version { nil }
end
trait :access_requestable do
request_access_enabled { true }
trait :request_access_disabled do
request_access_enabled { false }
end
trait :with_avatar do
......
......@@ -4,7 +4,7 @@ require 'spec_helper'
describe 'Groups > Members > Maintainer manages access requests' do
it_behaves_like 'Maintainer manages access requests' do
let(:entity) { create(:group, :public, :access_requestable) }
let(:entity) { create(:group, :public) }
let(:members_page_path) { group_group_members_path(entity) }
end
end
......@@ -5,7 +5,7 @@ require 'spec_helper'
describe 'Groups > Members > Request access' do
let(:user) { create(:user) }
let(:owner) { create(:user) }
let(:group) { create(:group, :public, :access_requestable) }
let(:group) { create(:group, :public) }
let!(:project) { create(:project, :private, namespace: group) }
before do
......
......@@ -5,8 +5,8 @@ require 'spec_helper'
describe 'Projects members' do
let(:user) { create(:user) }
let(:developer) { create(:user) }
let(:group) { create(:group, :public, :access_requestable) }
let(:project) { create(:project, :public, :access_requestable, creator: user, group: group) }
let(:group) { create(:group, :public) }
let(:project) { create(:project, :public, creator: user, group: group) }
let(:project_invitee) { create(:project_member, project: project, invite_token: '123', invite_email: 'test1@abc.com', user: nil) }
let(:group_invitee) { create(:group_member, group: group, invite_token: '123', invite_email: 'test2@abc.com', user: nil) }
let(:project_requester) { create(:user) }
......
......@@ -5,8 +5,8 @@ require 'spec_helper'
describe 'Projects > Members > Group requester cannot request access to project', :js do
let(:user) { create(:user) }
let(:owner) { create(:user) }
let(:group) { create(:group, :public, :access_requestable) }
let(:project) { create(:project, :public, :access_requestable, namespace: group) }
let(:group) { create(:group, :public) }
let(:project) { create(:project, :public, namespace: group) }
before do
group.add_owner(owner)
......
......@@ -4,7 +4,7 @@ require 'spec_helper'
describe 'Projects > Members > Maintainer manages access requests' do
it_behaves_like 'Maintainer manages access requests' do
let(:entity) { create(:project, :public, :access_requestable) }
let(:entity) { create(:project, :public) }
let(:members_page_path) { project_project_members_path(entity) }
end
end
......@@ -4,7 +4,7 @@ require 'spec_helper'
describe 'Projects > Members > User requests access', :js do
let(:user) { create(:user) }
let(:project) { create(:project, :public, :access_requestable, :repository) }
let(:project) { create(:project, :public, :repository) }
let(:maintainer) { project.owner }
before do
......
......@@ -5,13 +5,13 @@ describe AccessRequestsFinder do
let(:access_requester) { create(:user) }
let(:project) do
create(:project, :public, :access_requestable) do |project|
create(:project, :public) do |project|
project.request_access(access_requester)
end
end
let(:group) do
create(:group, :public, :access_requestable) do |group|
create(:group, :public) do |group|
group.request_access(access_requester)
end
end
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe GroupMembersFinder, '#execute' do
let(:group) { create(:group) }
let(:nested_group) { create(:group, :access_requestable, parent: group) }
let(:nested_group) { create(:group, parent: group) }
let(:user1) { create(:user) }
let(:user2) { create(:user) }
let(:user3) { create(:user) }
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe MembersFinder, '#execute' do
set(:group) { create(:group) }
set(:nested_group) { create(:group, :access_requestable, parent: group) }
set(:nested_group) { create(:group, parent: group) }
set(:project) { create(:project, namespace: nested_group) }
set(:user1) { create(:user) }
set(:user2) { create(:user) }
......@@ -55,7 +55,7 @@ describe MembersFinder, '#execute' do
context 'when include_invited_groups_members == true' do
subject { described_class.new(project, user2).execute(include_invited_groups_members: true) }
set(:linked_group) { create(:group, :public, :access_requestable) }
set(:linked_group) { create(:group, :public) }
set(:nested_linked_group) { create(:group, parent: linked_group) }
set(:linked_group_member) { linked_group.add_guest(user1) }
set(:nested_linked_group_member) { nested_linked_group.add_guest(user2) }
......
......@@ -5,11 +5,11 @@ require 'spec_helper'
describe MembersHelper do
describe '#remove_member_message' do
let(:requester) { create(:user) }
let(:project) { create(:project, :public, :access_requestable) }
let(:project) { create(:project, :public) }
let(:project_member) { build(:project_member, project: project) }
let(:project_member_invite) { build(:project_member, project: project).tap { |m| m.generate_invite_token! } }
let(:project_member_request) { project.request_access(requester) }
let(:group) { create(:group, :access_requestable) }
let(:group) { create(:group) }
let(:group_member) { build(:group_member, group: group) }
let(:group_member_invite) { build(:group_member, group: group).tap { |m| m.generate_invite_token! } }
let(:group_member_request) { group.request_access(requester) }
......@@ -26,10 +26,10 @@ describe MembersHelper do
describe '#remove_member_title' do
let(:requester) { create(:user) }
let(:project) { create(:project, :public, :access_requestable) }
let(:project) { create(:project, :public) }
let(:project_member) { build(:project_member, project: project) }
let(:project_member_request) { project.request_access(requester) }
let(:group) { create(:group, :access_requestable) }
let(:group) { create(:group) }
let(:group_member) { build(:group_member, group: group) }
let(:group_member_request) { group.request_access(requester) }
......
......@@ -714,7 +714,7 @@ describe Notify do
describe 'project access requested' do
let(:project) do
create(:project, :public, :access_requestable) do |project|
create(:project, :public) do |project|
project.add_maintainer(project.owner)
end
end
......@@ -743,7 +743,7 @@ describe Notify do
end
describe 'project access denied' do
let(:project) { create(:project, :public, :access_requestable) }
let(:project) { create(:project, :public) }
let(:project_member) do
project.request_access(user)
project.requesters.find_by(user_id: user.id)
......@@ -765,7 +765,7 @@ describe Notify do
describe 'project access changed' do
let(:owner) { create(:user, name: "Chang O'Keefe") }
let(:project) { create(:project, :public, :access_requestable, namespace: owner.namespace) }
let(:project) { create(:project, :public, namespace: owner.namespace) }
let(:project_member) { create(:project_member, project: project, user: user) }
subject { described_class.member_access_granted_email('project', project_member.id) }
......@@ -1167,7 +1167,7 @@ describe Notify do
context 'for a group' do
describe 'group access requested' do
let(:group) { create(:group, :public, :access_requestable) }
let(:group) { create(:group, :public) }
let(:group_member) do
group.request_access(user)
group.requesters.find_by(user_id: user.id)
......
......@@ -4,7 +4,7 @@ require 'spec_helper'
describe Ci::BuildMetadata do
set(:user) { create(:user) }
set(:group) { create(:group, :access_requestable) }
set(:group) { create(:group) }
set(:project) { create(:project, :repository, group: group, build_timeout: 2000) }
set(:pipeline) do
......
......@@ -4,7 +4,7 @@ require 'spec_helper'
describe Ci::Build do
set(:user) { create(:user) }
set(:group) { create(:group, :access_requestable) }
set(:group) { create(:group) }
set(:project) { create(:project, :repository, group: group) }
set(:pipeline) do
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
describe AccessRequestable do
describe 'Group' do
describe '#request_access' do
let(:group) { create(:group, :public, :access_requestable) }
let(:group) { create(:group, :public) }
let(:user) { create(:user) }
it { expect(group.request_access(user)).to be_a(GroupMember) }
......@@ -13,7 +13,7 @@ describe AccessRequestable do
end
describe '#access_requested?' do
let(:group) { create(:group, :public, :access_requestable) }
let(:group) { create(:group, :public) }
let(:user) { create(:user) }
before do
......@@ -26,14 +26,14 @@ describe AccessRequestable do
describe 'Project' do
describe '#request_access' do
let(:project) { create(:project, :public, :access_requestable) }
let(:project) { create(:project, :public) }
let(:user) { create(:user) }
it { expect(project.request_access(user)).to be_a(ProjectMember) }
end
describe '#access_requested?' do
let(:project) { create(:project, :public, :access_requestable) }
let(:project) { create(:project, :public) }
let(:user) { create(:user) }
before do
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
describe Group do
let!(:group) { create(:group, :access_requestable) }
let!(:group) { create(:group) }
describe 'associations' do
it { is_expected.to have_many :projects }
......@@ -331,7 +331,7 @@ describe Group do
end
describe '#avatar_url' do
let!(:group) { create(:group, :access_requestable, :with_avatar) }
let!(:group) { create(:group, :with_avatar) }
let(:user) { create(:user) }
context 'when avatar file is uploaded' do
......
......@@ -92,7 +92,7 @@ describe Member do
describe 'Scopes & finders' do
before do
project = create(:project, :public, :access_requestable)
project = create(:project, :public)
group = create(:group)
@owner_user = create(:user).tap { |u| group.add_owner(u) }
@owner = group.members.find_by(user_id: @owner_user.id)
......@@ -230,7 +230,7 @@ describe Member do
describe '.add_user' do
%w[project group].each do |source_type|
context "when source is a #{source_type}" do
let!(:source) { create(source_type, :public, :access_requestable) }
let!(:source) { create(source_type, :public) }
let!(:user) { create(:user) }
let!(:admin) { create(:admin) }
......@@ -437,7 +437,7 @@ describe Member do
describe '.add_users' do
%w[project group].each do |source_type|
context "when source is a #{source_type}" do
let!(:source) { create(source_type, :public, :access_requestable) }
let!(:source) { create(source_type, :public) }
let!(:admin) { create(:admin) }
let(:user1) { create(:user) }
let(:user2) { create(:user) }
......
......@@ -151,7 +151,7 @@ describe Project do
end
describe '#members & #requesters' do
let(:project) { create(:project, :public, :access_requestable) }
let(:project) { create(:project, :public) }
let(:requester) { create(:user) }
let(:developer) { create(:user) }
before do
......
......@@ -141,7 +141,7 @@ describe ProjectTeam do
describe '#find_member' do
context 'personal project' do
let(:project) do
create(:project, :public, :access_requestable)
create(:project, :public)
end
let(:requester) { create(:user) }
......@@ -161,7 +161,7 @@ describe ProjectTeam do
end
context 'group project' do
let(:group) { create(:group, :access_requestable) }
let(:group) { create(:group) }
let(:project) { create(:project, group: group) }
let(:requester) { create(:user) }
......@@ -246,7 +246,7 @@ describe ProjectTeam do
context 'personal project' do
let(:project) do
create(:project, :public, :access_requestable)
create(:project, :public)
end
context 'when project is not shared with group' do
......@@ -292,7 +292,7 @@ describe ProjectTeam do
end
context 'group project' do
let(:group) { create(:group, :access_requestable) }
let(:group) { create(:group) }
let!(:project) do
create(:project, group: group)
end
......
......@@ -79,7 +79,7 @@ describe User do
describe '#group_members' do
it 'does not include group memberships for which user is a requester' do
user = create(:user)
group = create(:group, :public, :access_requestable)
group = create(:group, :public)
group.request_access(user)
expect(user.group_members).to be_empty
......@@ -89,7 +89,7 @@ describe User do
describe '#project_members' do
it 'does not include project memberships for which user is a requester' do
user = create(:user)
project = create(:project, :public, :access_requestable)
project = create(:project, :public)
project.request_access(user)
expect(user.project_members).to be_empty
......@@ -1191,7 +1191,7 @@ describe User do
end
describe '.without_projects' do
let!(:project) { create(:project, :public, :access_requestable) }
let!(:project) { create(:project, :public) }
let!(:user) { create(:user) }
let!(:user_without_project) { create(:user) }
let!(:user_without_project2) { create(:user) }
......
......@@ -7,7 +7,7 @@ describe API::AccessRequests do
set(:stranger) { create(:user) }
set(:project) do
create(:project, :public, :access_requestable, creator_id: maintainer.id, namespace: maintainer.namespace) do |project|
create(:project, :public, creator_id: maintainer.id, namespace: maintainer.namespace) do |project|
project.add_developer(developer)
project.add_maintainer(maintainer)
project.request_access(access_requester)
......@@ -15,7 +15,7 @@ describe API::AccessRequests do
end
set(:group) do
create(:group, :public, :access_requestable) do |group|
create(:group, :public) do |group|
group.add_developer(developer)
group.add_owner(maintainer)
group.request_access(access_requester)
......
......@@ -345,7 +345,7 @@ describe API::Badges do
end
def setup_project
create(:project, :public, :access_requestable, creator_id: maintainer.id, namespace: project_group) do |project|
create(:project, :public, creator_id: maintainer.id, namespace: project_group) do |project|
project.add_developer(developer)
project.add_maintainer(maintainer)
project.request_access(access_requester)
......@@ -356,7 +356,7 @@ describe API::Badges do
end
def setup_group
create(:group, :public, :access_requestable) do |group|
create(:group, :public) do |group|
group.add_developer(developer)
group.add_owner(maintainer)
group.request_access(access_requester)
......
......@@ -7,7 +7,7 @@ describe API::Members do
let(:stranger) { create(:user) }
let(:project) do
create(:project, :public, :access_requestable, creator_id: maintainer.id, namespace: maintainer.namespace) do |project|
create(:project, :public, creator_id: maintainer.id, namespace: maintainer.namespace) do |project|
project.add_developer(developer)
project.add_maintainer(maintainer)
project.request_access(access_requester)
......@@ -15,7 +15,7 @@ describe API::Members do
end
let!(:group) do
create(:group, :public, :access_requestable) do |group|
create(:group, :public) do |group|
group.add_developer(developer)
group.add_owner(maintainer)
group.request_access(access_requester)
......
......@@ -3,8 +3,8 @@
require 'spec_helper'
describe Members::ApproveAccessRequestService do
let(:project) { create(:project, :public, :access_requestable) }
let(:group) { create(:group, :public, :access_requestable) }
let(:project) { create(:project, :public) }
let(:group) { create(:group, :public) }
let(:current_user) { create(:user) }
let(:access_requester_user) { create(:user) }
let(:access_requester) { source.requesters.find_by!(user_id: access_requester_user.id) }
......
......@@ -41,7 +41,7 @@ describe Members::RequestAccessService do
context 'when access requests are disabled' do
%i[project group].each do |source_type|
it_behaves_like 'a service raising Gitlab::Access::AccessDeniedError' do
let(:source) { create(source_type, :public) }
let(:source) { create(source_type, :public, :request_access_disabled) }
end
end
end
......@@ -49,7 +49,7 @@ describe Members::RequestAccessService do
context 'when current user can request access to the project' do
%i[project group].each do |source_type|
it_behaves_like 'a service creating a access request' do
let(:source) { create(source_type, :public, :access_requestable) }
let(:source) { create(source_type, :public) }
end
end
end
......
......@@ -1942,7 +1942,7 @@ describe NotificationService, :mailer do
let(:developer) { create(:user) }
let!(:group) do
create(:group, :public, :access_requestable) do |group|
create(:group, :public) do |group|
group.add_owner(owner)
group.add_maintainer(maintainer)
group.add_developer(developer)
......@@ -1968,7 +1968,7 @@ describe NotificationService, :mailer do
end
it_behaves_like 'sends notification only to a maximum of ten, most recently active group owners' do
let(:group) { create(:group, :public, :access_requestable) }
let(:group) { create(:group, :public) }
let(:notification_trigger) { group.request_access(added_user) }
end
end
......@@ -2029,7 +2029,7 @@ describe NotificationService, :mailer do
let(:maintainer) { create(:user) }
let!(:project) do
create(:project, :public, :access_requestable) do |project|
create(:project, :public) do |project|
project.add_developer(developer)
project.add_maintainer(maintainer)
end
......@@ -2053,7 +2053,7 @@ describe NotificationService, :mailer do
end
it_behaves_like 'sends notification only to a maximum of ten, most recently active project maintainers' do
let(:project) { create(:project, :public, :access_requestable) }
let(:project) { create(:project, :public) }
let(:notification_trigger) { project.request_access(added_user) }
end
end
......@@ -2064,7 +2064,7 @@ describe NotificationService, :mailer do
context 'when the project has no maintainers' do
context 'when the group has at least one owner' do
let!(:project) { create(:project, :public, :access_requestable, namespace: group) }
let!(:project) { create(:project, :public, namespace: group) }
before do
reset_delivered_emails!
......@@ -2079,14 +2079,14 @@ describe NotificationService, :mailer do
end
it_behaves_like 'sends notification only to a maximum of ten, most recently active group owners' do
let(:group) { create(:group, :public, :access_requestable) }
let(:group) { create(:group, :public) }
let(:notification_trigger) { project.request_access(added_user) }
end
end
context 'when the group does not have any owners' do
let(:group) { create(:group) }
let!(:project) { create(:project, :public, :access_requestable, namespace: group) }
let!(:project) { create(:project, :public, namespace: group) }
context 'recipients' do
before do
......@@ -2107,7 +2107,7 @@ describe NotificationService, :mailer do
let(:developer) { create(:user) }
let!(:project) do
create(:project, :public, :access_requestable, namespace: group) do |project|
create(:project, :public, namespace: group) do |project|
project.add_maintainer(maintainer)
project.add_developer(developer)
end
......@@ -2128,7 +2128,7 @@ describe NotificationService, :mailer do
end
it_behaves_like 'sends notification only to a maximum of ten, most recently active project maintainers' do
let(:project) { create(:project, :public, :access_requestable, namespace: group) }
let(:project) { create(:project, :public, namespace: group) }
let(:notification_trigger) { project.request_access(added_user) }
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment