Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-12-21 12:17:08 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-12-21 12:17:08 +0300
commit4ecd816dcbbf2c3a83087ea1add13f087530e9eb (patch)
treefaf1d225bf16fa64dea1244217b3f8b6e7dac46d /spec/lib
parenta293ae1ab5e4253f6003123c79c00bf7b953a7e5 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/api/entities/group_spec.rb24
-rw-r--r--spec/lib/api/helpers_spec.rb61
2 files changed, 1 insertions, 84 deletions
diff --git a/spec/lib/api/entities/group_spec.rb b/spec/lib/api/entities/group_spec.rb
deleted file mode 100644
index 270ac323c7d..00000000000
--- a/spec/lib/api/entities/group_spec.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe API::Entities::Group, feature_category: :groups_and_projects do
- let_it_be(:group) do
- base_group = create(:group) { |g| create(:project_statistics, namespace_id: g.id) }
- Group.with_statistics.find(base_group.id)
- end
-
- subject(:json) { described_class.new(group, { with_custom_attributes: true, statistics: true }).as_json }
-
- it 'returns expected data' do
- expect(json.keys).to(
- include(
- :organization_id, :path, :description, :visibility, :share_with_group_lock, :require_two_factor_authentication,
- :two_factor_grace_period, :project_creation_level, :auto_devops_enabled,
- :subgroup_creation_level, :emails_disabled, :emails_enabled, :lfs_enabled, :default_branch_protection,
- :default_branch_protection_defaults, :avatar_url, :request_access_enabled, :full_name, :full_path, :created_at,
- :parent_id, :organization_id, :shared_runners_setting, :custom_attributes, :statistics
- )
- )
- end
-end
diff --git a/spec/lib/api/helpers_spec.rb b/spec/lib/api/helpers_spec.rb
index 89fcb4b43a6..c76694b60d3 100644
--- a/spec/lib/api/helpers_spec.rb
+++ b/spec/lib/api/helpers_spec.rb
@@ -406,37 +406,6 @@ RSpec.describe API::Helpers, feature_category: :shared do
end
end
- describe '#find_organization!' do
- let_it_be(:organization) { create(:organization) }
- let_it_be(:user) { create(:user) }
-
- before do
- allow(helper).to receive(:current_user).and_return(user)
- allow(helper).to receive(:initial_current_user).and_return(user)
- end
-
- context 'when user is authenticated' do
- it 'returns requested organization' do
- expect(helper.find_organization!(organization.id)).to eq(organization)
- end
- end
-
- context 'when user is not authenticated' do
- let(:user) { nil }
-
- it 'returns requested organization' do
- expect(helper.find_organization!(organization.id)).to eq(organization)
- end
- end
-
- context 'when organization does not exist' do
- it 'returns nil' do
- expect(helper).to receive(:render_api_error!).with('404 Organization Not Found', 404)
- expect(helper.find_organization!(non_existing_record_id)).to be_nil
- end
- end
- end
-
describe '#find_group!' do
let_it_be(:group) { create(:group, :public) }
let_it_be(:user) { create(:user) }
@@ -488,7 +457,7 @@ RSpec.describe API::Helpers, feature_category: :shared do
end
end
- context 'with support for IDs and paths as arguments' do
+ context 'support for IDs and paths as arguments' do
let_it_be(:group) { create(:group) }
let(:user) { group.first_owner }
@@ -534,34 +503,6 @@ RSpec.describe API::Helpers, feature_category: :shared do
it_behaves_like 'group finder'
end
end
-
- context 'with support for organization as an argument' do
- let_it_be(:group) { create(:group) }
- let_it_be(:organization) { create(:organization) }
-
- before do
- allow(helper).to receive(:current_user).and_return(group.first_owner)
- allow(helper).to receive(:job_token_authentication?).and_return(false)
- allow(helper).to receive(:authenticate_non_public?).and_return(false)
- end
-
- subject { helper.find_group!(group.id, organization: organization) }
-
- context 'when group exists in the organization' do
- before do
- group.update!(organization: organization)
- end
-
- it { is_expected.to eq(group) }
- end
-
- context 'when group does not exist in the organization' do
- it 'returns nil' do
- expect(helper).to receive(:render_api_error!).with('404 Group Not Found', 404)
- is_expected.to be_nil
- end
- end
- end
end
describe '#find_group_by_full_path!' do