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