summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/projects/releases_controller_spec.rb40
-rw-r--r--spec/features/clusters/cluster_detail_page_spec.rb14
-rw-r--r--spec/features/clusters/installing_applications_shared_examples.rb7
-rw-r--r--spec/features/groups/clusters/user_spec.rb7
-rw-r--r--spec/features/projects/clusters/gcp_spec.rb5
-rw-r--r--spec/features/projects/clusters/user_spec.rb7
-rw-r--r--spec/features/projects/releases/user_views_releases_spec.rb17
-rw-r--r--spec/features/projects/snippets/user_updates_snippet_spec.rb2
-rw-r--r--spec/features/snippets/user_edits_snippet_spec.rb2
-rw-r--r--spec/frontend/releases/components/evidence_block_spec.js2
-rw-r--r--spec/frontend/releases/components/release_block_milestone_info_spec.js80
-rw-r--r--spec/frontend/releases/components/release_block_spec.js2
-rw-r--r--spec/frontend/releases/mock_data.js6
-rw-r--r--spec/helpers/auth_helper_spec.rb2
-rw-r--r--spec/lib/gitlab/auth/ldap/access_spec.rb10
-rw-r--r--spec/lib/gitlab/auth/ldap/adapter_spec.rb10
-rw-r--r--spec/lib/gitlab/auth/ldap/auth_hash_spec.rb4
-rw-r--r--spec/lib/gitlab/auth/ldap/authentication_spec.rb8
-rw-r--r--spec/lib/gitlab/auth/ldap/config_spec.rb2
-rw-r--r--spec/lib/gitlab/auth/ldap/dn_spec.rb50
-rw-r--r--spec/lib/gitlab/auth/ldap/person_spec.rb4
-rw-r--r--spec/lib/gitlab/auth/ldap/user_spec.rb2
-rw-r--r--spec/lib/gitlab/auth/o_auth/user_spec.rb36
-rw-r--r--spec/lib/gitlab/auth/saml/user_spec.rb16
-rw-r--r--spec/lib/gitlab/auth_spec.rb10
-rw-r--r--spec/lib/gitlab/bare_repository_import/repository_spec.rb9
-rw-r--r--spec/lib/gitlab/git/repository_spec.rb4
-rw-r--r--spec/models/user_spec.rb2
-rw-r--r--spec/requests/git_http_spec.rb8
-rw-r--r--spec/services/projects/create_service_spec.rb17
-rw-r--r--spec/services/projects/fork_service_spec.rb8
-rw-r--r--spec/services/projects/transfer_service_spec.rb12
-rw-r--r--spec/services/projects/update_service_spec.rb8
-rw-r--r--spec/support/helpers/ldap_helpers.rb24
-rw-r--r--spec/support/shared_contexts/controllers/ldap_omniauth_callbacks_controller_shared_context.rb2
-rw-r--r--spec/tasks/gitlab/check_rake_spec.rb8
-rw-r--r--spec/workers/post_receive_spec.rb18
37 files changed, 284 insertions, 181 deletions
diff --git a/spec/controllers/projects/releases_controller_spec.rb b/spec/controllers/projects/releases_controller_spec.rb
index 58fb2a95ce6..ca073c520cd 100644
--- a/spec/controllers/projects/releases_controller_spec.rb
+++ b/spec/controllers/projects/releases_controller_spec.rb
@@ -200,6 +200,46 @@ describe Projects::ReleasesController do
context 'GET #downloads' do
subject do
+ get :downloads, params: { namespace_id: project.namespace, project_id: project, tag: tag, filepath: filepath }
+ end
+
+ before do
+ sign_in(user)
+ end
+
+ let(:release) { create(:release, project: project, tag: tag ) }
+ let!(:link) { create(:release_link, release: release, name: 'linux-amd64 binaries', filepath: '/binaries/linux-amd64', url: 'https://downloads.example.com/bin/gitlab-linux-amd64') }
+ let(:tag) { 'v11.9.0-rc2' }
+
+ context 'valid filepath' do
+ let(:filepath) { CGI.escape('/binaries/linux-amd64') }
+
+ it 'redirects to the asset direct link' do
+ subject
+
+ expect(response).to redirect_to('https://downloads.example.com/bin/gitlab-linux-amd64')
+ end
+
+ it 'redirects with a status of 302' do
+ subject
+
+ expect(response).to have_gitlab_http_status(:redirect)
+ end
+ end
+
+ context 'invalid filepath' do
+ let(:filepath) { CGI.escape('/binaries/win32') }
+
+ it 'is not found' do
+ subject
+
+ expect(response).to have_gitlab_http_status(:not_found)
+ end
+ end
+ end
+
+ context 'GET #downloads' do
+ subject do
get :downloads, params: {
namespace_id: project.namespace,
project_id: project,
diff --git a/spec/features/clusters/cluster_detail_page_spec.rb b/spec/features/clusters/cluster_detail_page_spec.rb
index 437e7f18c48..28d6c10f04f 100644
--- a/spec/features/clusters/cluster_detail_page_spec.rb
+++ b/spec/features/clusters/cluster_detail_page_spec.rb
@@ -17,7 +17,7 @@ describe 'Clusterable > Show page' do
it 'allow the user to set domain' do
visit cluster_path
- within '#cluster-integration' do
+ within '.js-cluster-integration-form' do
fill_in('cluster_base_domain', with: 'test.com')
click_on 'Save changes'
end
@@ -34,7 +34,7 @@ describe 'Clusterable > Show page' do
end
it 'shows help text with the domain as an alternative to custom domain' do
- within '#cluster-integration' do
+ within '.js-cluster-integration-form' do
expect(find(cluster_ingress_help_text_selector)).not_to match_css(hide_modifier_selector)
end
end
@@ -44,7 +44,7 @@ describe 'Clusterable > Show page' do
it 'alternative to custom domain is not shown' do
visit cluster_path
- within '#cluster-integration' do
+ within '.js-cluster-integration-form' do
expect(find(cluster_ingress_help_text_selector)).to match_css(hide_modifier_selector)
end
end
@@ -63,7 +63,7 @@ describe 'Clusterable > Show page' do
end
it 'is not able to edit the name, API url, CA certificate nor token' do
- within('#js-cluster-details') do
+ within('.js-provider-details') do
cluster_name_field = find('.cluster-name')
api_url_field = find('#cluster_platform_kubernetes_attributes_api_url')
ca_certificate_field = find('#cluster_platform_kubernetes_attributes_ca_cert')
@@ -77,6 +77,8 @@ describe 'Clusterable > Show page' do
end
it 'displays GKE information' do
+ click_link 'Advanced Settings'
+
within('#advanced-settings-section') do
expect(page).to have_content('Google Kubernetes Engine')
expect(page).to have_content('Manage your Kubernetes cluster by visiting')
@@ -91,7 +93,7 @@ describe 'Clusterable > Show page' do
end
it 'is able to edit the name, API url, CA certificate and token' do
- within('#js-cluster-details') do
+ within('.js-provider-details') do
cluster_name_field = find('#cluster_name')
api_url_field = find('#cluster_platform_kubernetes_attributes_api_url')
ca_certificate_field = find('#cluster_platform_kubernetes_attributes_ca_cert')
@@ -105,6 +107,8 @@ describe 'Clusterable > Show page' do
end
it 'does not display GKE information' do
+ click_link 'Advanced Settings'
+
within('#advanced-settings-section') do
expect(page).not_to have_content('Google Kubernetes Engine')
expect(page).not_to have_content('Manage your Kubernetes cluster by visiting')
diff --git a/spec/features/clusters/installing_applications_shared_examples.rb b/spec/features/clusters/installing_applications_shared_examples.rb
index ff44ce46213..8710e05e5cc 100644
--- a/spec/features/clusters/installing_applications_shared_examples.rb
+++ b/spec/features/clusters/installing_applications_shared_examples.rb
@@ -17,6 +17,12 @@ shared_examples "installing applications on a cluster" do
context 'when cluster is created' do
let(:cluster) { create(:cluster, :provided_by_gcp, *cluster_factory_args) }
+ before do
+ page.within('.js-edit-cluster-form') do
+ click_link 'Applications'
+ end
+ end
+
it 'user can install applications' do
wait_for_requests
@@ -29,6 +35,7 @@ shared_examples "installing applications on a cluster" do
context 'when user installs Helm' do
before do
allow(ClusterInstallAppWorker).to receive(:perform_async)
+ wait_for_requests
page.within('.js-cluster-application-row-helm') do
page.find(:css, '.js-cluster-application-install-button').click
diff --git a/spec/features/groups/clusters/user_spec.rb b/spec/features/groups/clusters/user_spec.rb
index ceec50e4f58..e9ef66e31a2 100644
--- a/spec/features/groups/clusters/user_spec.rb
+++ b/spec/features/groups/clusters/user_spec.rb
@@ -34,7 +34,7 @@ describe 'User Cluster', :js do
it 'user sees a cluster details page' do
subject
- expect(page).to have_content('Kubernetes cluster integration')
+ expect(page).to have_content('GitLab Integration')
expect(page.find_field('cluster[name]').value).to eq('dev-cluster')
expect(page.find_field('cluster[platform_kubernetes_attributes][api_url]').value)
.to have_content('http://example.com')
@@ -93,7 +93,7 @@ describe 'User Cluster', :js do
context 'when user disables the cluster' do
before do
page.find(:css, '.js-cluster-enable-toggle-area .js-project-feature-toggle').click
- page.within('#cluster-integration') { click_button 'Save changes' }
+ page.within('.js-cluster-integration-form') { click_button 'Save changes' }
end
it 'user sees the successful message' do
@@ -105,7 +105,7 @@ describe 'User Cluster', :js do
before do
fill_in 'cluster_name', with: 'my-dev-cluster'
fill_in 'cluster_platform_kubernetes_attributes_token', with: 'new-token'
- page.within('#js-cluster-details') { click_button 'Save changes' }
+ page.within('.js-provider-details') { click_button 'Save changes' }
end
it 'user sees the successful message' do
@@ -117,6 +117,7 @@ describe 'User Cluster', :js do
context 'when user destroys the cluster' do
before do
+ click_link 'Advanced Settings'
click_button 'Remove integration and resources'
fill_in 'confirm_cluster_name_input', with: cluster.name
click_button 'Remove integration'
diff --git a/spec/features/projects/clusters/gcp_spec.rb b/spec/features/projects/clusters/gcp_spec.rb
index 56ee2819bdb..df786cf0818 100644
--- a/spec/features/projects/clusters/gcp_spec.rb
+++ b/spec/features/projects/clusters/gcp_spec.rb
@@ -119,7 +119,7 @@ describe 'Gcp Cluster', :js, :do_not_mock_admin_mode do
context 'when user disables the cluster' do
before do
page.find(:css, '.js-cluster-enable-toggle-area .js-project-feature-toggle').click
- page.within('#cluster-integration') { click_button 'Save changes' }
+ page.within('.js-cluster-integration-form') { click_button 'Save changes' }
end
it 'user sees the successful message' do
@@ -130,7 +130,7 @@ describe 'Gcp Cluster', :js, :do_not_mock_admin_mode do
context 'when user changes cluster parameters' do
before do
fill_in 'cluster_platform_kubernetes_attributes_namespace', with: 'my-namespace'
- page.within('#js-cluster-details') { click_button 'Save changes' }
+ page.within('.js-provider-details') { click_button 'Save changes' }
end
it 'user sees the successful message' do
@@ -141,6 +141,7 @@ describe 'Gcp Cluster', :js, :do_not_mock_admin_mode do
context 'when user destroys the cluster' do
before do
+ click_link 'Advanced Settings'
click_button 'Remove integration and resources'
fill_in 'confirm_cluster_name_input', with: cluster.name
click_button 'Remove integration'
diff --git a/spec/features/projects/clusters/user_spec.rb b/spec/features/projects/clusters/user_spec.rb
index 38efcf758e1..79676927fa2 100644
--- a/spec/features/projects/clusters/user_spec.rb
+++ b/spec/features/projects/clusters/user_spec.rb
@@ -41,7 +41,7 @@ describe 'User Cluster', :js do
it 'user sees a cluster details page' do
subject
- expect(page).to have_content('Kubernetes cluster integration')
+ expect(page).to have_content('GitLab Integration')
expect(page.find_field('cluster[name]').value).to eq('dev-cluster')
expect(page.find_field('cluster[platform_kubernetes_attributes][api_url]').value)
.to have_content('http://example.com')
@@ -79,7 +79,7 @@ describe 'User Cluster', :js do
context 'when user disables the cluster' do
before do
page.find(:css, '.js-cluster-enable-toggle-area .js-project-feature-toggle').click
- page.within('#cluster-integration') { click_button 'Save changes' }
+ page.within('.js-cluster-integration-form') { click_button 'Save changes' }
end
it 'user sees the successful message' do
@@ -91,7 +91,7 @@ describe 'User Cluster', :js do
before do
fill_in 'cluster_name', with: 'my-dev-cluster'
fill_in 'cluster_platform_kubernetes_attributes_namespace', with: 'my-namespace'
- page.within('#js-cluster-details') { click_button 'Save changes' }
+ page.within('.js-provider-details') { click_button 'Save changes' }
end
it 'user sees the successful message' do
@@ -103,6 +103,7 @@ describe 'User Cluster', :js do
context 'when user destroys the cluster' do
before do
+ click_link 'Advanced Settings'
click_button 'Remove integration and resources'
fill_in 'confirm_cluster_name_input', with: cluster.name
click_button 'Remove integration'
diff --git a/spec/features/projects/releases/user_views_releases_spec.rb b/spec/features/projects/releases/user_views_releases_spec.rb
index 4507d90576b..a4ba81ffeb9 100644
--- a/spec/features/projects/releases/user_views_releases_spec.rb
+++ b/spec/features/projects/releases/user_views_releases_spec.rb
@@ -24,16 +24,31 @@ describe 'User views releases', :js do
context 'when there is a link as an asset' do
let!(:release_link) { create(:release_link, release: release, url: url ) }
let(:url) { "#{project.web_url}/-/jobs/1/artifacts/download" }
+ let(:direct_asset_link) { Gitlab::Routing.url_helpers.project_release_url(project, release) << release_link.filepath }
it 'sees the link' do
visit project_releases_path(project)
page.within('.js-assets-list') do
- expect(page).to have_link release_link.name, href: release_link.url
+ expect(page).to have_link release_link.name, href: direct_asset_link
expect(page).not_to have_content('(external source)')
end
end
+ context 'when there is a link redirect' do
+ let!(:release_link) { create(:release_link, release: release, name: 'linux-amd64 binaries', filepath: '/binaries/linux-amd64', url: url) }
+ let(:url) { "#{project.web_url}/-/jobs/1/artifacts/download" }
+
+ it 'sees the link' do
+ visit project_releases_path(project)
+
+ page.within('.js-assets-list') do
+ expect(page).to have_link release_link.name, href: direct_asset_link
+ expect(page).not_to have_content('(external source)')
+ end
+ end
+ end
+
context 'when url points to external resource' do
let(:url) { 'http://google.com/download' }
diff --git a/spec/features/projects/snippets/user_updates_snippet_spec.rb b/spec/features/projects/snippets/user_updates_snippet_spec.rb
index 0c3438575ba..f9628b37089 100644
--- a/spec/features/projects/snippets/user_updates_snippet_spec.rb
+++ b/spec/features/projects/snippets/user_updates_snippet_spec.rb
@@ -38,7 +38,7 @@ describe 'Projects > Snippets > User updates a snippet' do
end
it 'renders edit page and displays the error' do
- expect(page).to have_content('Error updating the snippet')
+ expect(page.find('.flash-container span').text).to eq('Error updating the snippet')
expect(page).to have_content('Edit Snippet')
end
end
diff --git a/spec/features/snippets/user_edits_snippet_spec.rb b/spec/features/snippets/user_edits_snippet_spec.rb
index 706758164b2..b003e50aab7 100644
--- a/spec/features/snippets/user_edits_snippet_spec.rb
+++ b/spec/features/snippets/user_edits_snippet_spec.rb
@@ -71,7 +71,7 @@ describe 'User edits snippet', :js do
end
it 'renders edit page and displays the error' do
- expect(page).to have_content('Error updating the snippet')
+ expect(page.find('.flash-container span').text).to eq('Error updating the snippet')
expect(page).to have_content('Edit Snippet')
end
end
diff --git a/spec/frontend/releases/components/evidence_block_spec.js b/spec/frontend/releases/components/evidence_block_spec.js
index fb62f4a3bfe..c76a0e04dce 100644
--- a/spec/frontend/releases/components/evidence_block_spec.js
+++ b/spec/frontend/releases/components/evidence_block_spec.js
@@ -67,7 +67,7 @@ describe('Evidence Block', () => {
});
it('renders the correct hover text', () => {
- expect(wrapper.find(ClipboardButton).attributes('title')).toBe('Copy commit SHA');
+ expect(wrapper.find(ClipboardButton).attributes('title')).toBe('Copy evidence SHA');
});
it('copies the sha', () => {
diff --git a/spec/frontend/releases/components/release_block_milestone_info_spec.js b/spec/frontend/releases/components/release_block_milestone_info_spec.js
index 10f5db96b31..0e79c45b337 100644
--- a/spec/frontend/releases/components/release_block_milestone_info_spec.js
+++ b/spec/frontend/releases/components/release_block_milestone_info_spec.js
@@ -10,11 +10,9 @@ describe('Release block milestone info', () => {
let wrapper;
let milestones;
- const factory = milestonesProp => {
+ const factory = props => {
wrapper = mount(ReleaseBlockMilestoneInfo, {
- propsData: {
- milestones: milestonesProp,
- },
+ propsData: props,
});
return wrapper.vm.$nextTick();
@@ -26,6 +24,7 @@ describe('Release block milestone info', () => {
afterEach(() => {
wrapper.destroy();
+ wrapper = null;
});
const milestoneProgressBarContainer = () => wrapper.find('.js-milestone-progress-bar-container');
@@ -33,7 +32,7 @@ describe('Release block milestone info', () => {
const issuesContainer = () => wrapper.find('.js-issues-container');
describe('with default props', () => {
- beforeEach(() => factory(milestones));
+ beforeEach(() => factory({ milestones }));
it('renders the correct percentage', () => {
expect(milestoneProgressBarContainer().text()).toContain('41% complete');
@@ -102,7 +101,7 @@ describe('Release block milestone info', () => {
.map(m => m.title)
.join(' • ');
- return factory(lotsOfMilestones);
+ return factory({ milestones: lotsOfMilestones });
});
const clickShowMoreFewerButton = () => {
@@ -153,12 +152,12 @@ describe('Release block milestone info', () => {
...m,
issueStats: {
...m.issueStats,
- opened: 0,
+ total: 0,
closed: 0,
},
}));
- return factory(milestones);
+ return factory({ milestones });
});
expectAllZeros();
@@ -171,9 +170,72 @@ describe('Release block milestone info', () => {
issueStats: undefined,
}));
- return factory(milestones);
+ return factory({ milestones });
});
expectAllZeros();
});
+
+ describe('Issue links', () => {
+ const findOpenIssuesLink = () => wrapper.find({ ref: 'openIssuesLink' });
+ const findOpenIssuesText = () => wrapper.find({ ref: 'openIssuesText' });
+ const findClosedIssuesLink = () => wrapper.find({ ref: 'closedIssuesLink' });
+ const findClosedIssuesText = () => wrapper.find({ ref: 'closedIssuesText' });
+
+ describe('when openIssuePath is provided', () => {
+ const openIssuesPath = '/path/to/open/issues';
+
+ beforeEach(() => {
+ return factory({ milestones, openIssuesPath });
+ });
+
+ it('renders the open issues as a link', () => {
+ expect(findOpenIssuesLink().exists()).toBe(true);
+ expect(findOpenIssuesText().exists()).toBe(false);
+ });
+
+ it('renders the open issues link with the correct href', () => {
+ expect(findOpenIssuesLink().attributes().href).toBe(openIssuesPath);
+ });
+ });
+
+ describe('when openIssuePath is not provided', () => {
+ beforeEach(() => {
+ return factory({ milestones });
+ });
+
+ it('renders the open issues as plain text', () => {
+ expect(findOpenIssuesLink().exists()).toBe(false);
+ expect(findOpenIssuesText().exists()).toBe(true);
+ });
+ });
+
+ describe('when closedIssuePath is provided', () => {
+ const closedIssuesPath = '/path/to/closed/issues';
+
+ beforeEach(() => {
+ return factory({ milestones, closedIssuesPath });
+ });
+
+ it('renders the closed issues as a link', () => {
+ expect(findClosedIssuesLink().exists()).toBe(true);
+ expect(findClosedIssuesText().exists()).toBe(false);
+ });
+
+ it('renders the closed issues link with the correct href', () => {
+ expect(findClosedIssuesLink().attributes().href).toBe(closedIssuesPath);
+ });
+ });
+
+ describe('when closedIssuePath is not provided', () => {
+ beforeEach(() => {
+ return factory({ milestones });
+ });
+
+ it('renders the closed issues as plain text', () => {
+ expect(findClosedIssuesLink().exists()).toBe(false);
+ expect(findClosedIssuesText().exists()).toBe(true);
+ });
+ });
+ });
});
diff --git a/spec/frontend/releases/components/release_block_spec.js b/spec/frontend/releases/components/release_block_spec.js
index 227998b0271..7ea2379ea35 100644
--- a/spec/frontend/releases/components/release_block_spec.js
+++ b/spec/frontend/releases/components/release_block_spec.js
@@ -92,7 +92,7 @@ describe('Release block', () => {
expect(wrapper.findAll('.js-assets-list li').length).toEqual(release.assets.links.length);
expect(wrapper.find('.js-assets-list li a').attributes().href).toEqual(
- first(release.assets.links).url,
+ first(release.assets.links).directAssetUrl,
);
expect(wrapper.find('.js-assets-list li a').text()).toContain(
diff --git a/spec/frontend/releases/mock_data.js b/spec/frontend/releases/mock_data.js
index c2d3f00550a..85e6bab71ba 100644
--- a/spec/frontend/releases/mock_data.js
+++ b/spec/frontend/releases/mock_data.js
@@ -12,7 +12,7 @@ export const milestones = [
start_date: '2019-08-31',
web_url: 'http://0.0.0.0:3001/root/release-test/-/milestones/2',
issue_stats: {
- opened: 14,
+ total: 33,
closed: 19,
},
},
@@ -29,7 +29,7 @@ export const milestones = [
start_date: '2019-08-19',
web_url: 'http://0.0.0.0:3001/root/release-test/-/milestones/1',
issue_stats: {
- opened: 18,
+ total: 21,
closed: 3,
},
},
@@ -96,6 +96,7 @@ export const release = {
id: 1,
name: 'my link',
url: 'https://google.com',
+ direct_asset_url: 'https://redirected.google.com',
external: true,
},
{
@@ -103,6 +104,7 @@ export const release = {
name: 'my second link',
url:
'https://gitlab.com/gitlab-org/gitlab-foss/-/jobs/artifacts/v11.6.0-rc4/download?job=rspec-mysql+41%2F50',
+ direct_asset_url: 'https://redirected.google.com',
external: false,
},
],
diff --git a/spec/helpers/auth_helper_spec.rb b/spec/helpers/auth_helper_spec.rb
index 073ce581741..1764a2bbc3c 100644
--- a/spec/helpers/auth_helper_spec.rb
+++ b/spec/helpers/auth_helper_spec.rb
@@ -56,7 +56,7 @@ describe AuthHelper do
describe 'any_form_based_providers_enabled?' do
before do
- allow(Gitlab::Auth::LDAP::Config).to receive(:enabled?).and_return(true)
+ allow(Gitlab::Auth::Ldap::Config).to receive(:enabled?).and_return(true)
end
it 'detects form-based providers' do
diff --git a/spec/lib/gitlab/auth/ldap/access_spec.rb b/spec/lib/gitlab/auth/ldap/access_spec.rb
index f9eb4a30190..2f691429541 100644
--- a/spec/lib/gitlab/auth/ldap/access_spec.rb
+++ b/spec/lib/gitlab/auth/ldap/access_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-describe Gitlab::Auth::LDAP::Access do
+describe Gitlab::Auth::Ldap::Access do
include LdapHelpers
let(:user) { create(:omniauth_user) }
@@ -64,7 +64,7 @@ describe Gitlab::Auth::LDAP::Access do
context 'and the user is disabled via active directory' do
before do
- allow(Gitlab::Auth::LDAP::Person).to receive(:disabled_via_active_directory?).and_return(true)
+ allow(Gitlab::Auth::Ldap::Person).to receive(:disabled_via_active_directory?).and_return(true)
end
it 'returns false' do
@@ -90,7 +90,7 @@ describe Gitlab::Auth::LDAP::Access do
context 'and has no disabled flag in active directory' do
before do
- allow(Gitlab::Auth::LDAP::Person).to receive(:disabled_via_active_directory?).and_return(false)
+ allow(Gitlab::Auth::Ldap::Person).to receive(:disabled_via_active_directory?).and_return(false)
end
it { is_expected.to be_truthy }
@@ -135,8 +135,8 @@ describe Gitlab::Auth::LDAP::Access do
context 'without ActiveDirectory enabled' do
before do
- allow(Gitlab::Auth::LDAP::Config).to receive(:enabled?).and_return(true)
- allow_next_instance_of(Gitlab::Auth::LDAP::Config) do |instance|
+ allow(Gitlab::Auth::Ldap::Config).to receive(:enabled?).and_return(true)
+ allow_next_instance_of(Gitlab::Auth::Ldap::Config) do |instance|
allow(instance).to receive(:active_directory).and_return(false)
end
end
diff --git a/spec/lib/gitlab/auth/ldap/adapter_spec.rb b/spec/lib/gitlab/auth/ldap/adapter_spec.rb
index 54486913b72..34853acdd0f 100644
--- a/spec/lib/gitlab/auth/ldap/adapter_spec.rb
+++ b/spec/lib/gitlab/auth/ldap/adapter_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-describe Gitlab::Auth::LDAP::Adapter do
+describe Gitlab::Auth::Ldap::Adapter do
include LdapHelpers
let(:ldap) { double(:ldap) }
@@ -138,7 +138,7 @@ describe Gitlab::Auth::LDAP::Adapter do
it 'as many times as MAX_SEARCH_RETRIES' do
expect(ldap).to receive(:search).exactly(3).times
- expect { subject }.to raise_error(Gitlab::Auth::LDAP::LDAPConnectionError)
+ expect { subject }.to raise_error(Gitlab::Auth::Ldap::LdapConnectionError)
end
context 'when no more retries' do
@@ -147,11 +147,11 @@ describe Gitlab::Auth::LDAP::Adapter do
end
it 'raises the exception' do
- expect { subject }.to raise_error(Gitlab::Auth::LDAP::LDAPConnectionError)
+ expect { subject }.to raise_error(Gitlab::Auth::Ldap::LdapConnectionError)
end
it 'logs the error' do
- expect { subject }.to raise_error(Gitlab::Auth::LDAP::LDAPConnectionError)
+ expect { subject }.to raise_error(Gitlab::Auth::Ldap::LdapConnectionError)
expect(Rails.logger).to have_received(:warn).with(
"LDAP search raised exception Net::LDAP::Error: some error")
end
@@ -161,6 +161,6 @@ describe Gitlab::Auth::LDAP::Adapter do
end
def ldap_attributes
- Gitlab::Auth::LDAP::Person.ldap_attributes(Gitlab::Auth::LDAP::Config.new('ldapmain'))
+ Gitlab::Auth::Ldap::Person.ldap_attributes(Gitlab::Auth::Ldap::Config.new('ldapmain'))
end
end
diff --git a/spec/lib/gitlab/auth/ldap/auth_hash_spec.rb b/spec/lib/gitlab/auth/ldap/auth_hash_spec.rb
index f1050b9f830..7bc92d0abea 100644
--- a/spec/lib/gitlab/auth/ldap/auth_hash_spec.rb
+++ b/spec/lib/gitlab/auth/ldap/auth_hash_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-describe Gitlab::Auth::LDAP::AuthHash do
+describe Gitlab::Auth::Ldap::AuthHash do
include LdapHelpers
let(:auth_hash) do
@@ -58,7 +58,7 @@ describe Gitlab::Auth::LDAP::AuthHash do
end
before do
- allow_next_instance_of(Gitlab::Auth::LDAP::Config) do |instance|
+ allow_next_instance_of(Gitlab::Auth::Ldap::Config) do |instance|
allow(instance).to receive(:attributes).and_return(attributes)
end
end
diff --git a/spec/lib/gitlab/auth/ldap/authentication_spec.rb b/spec/lib/gitlab/auth/ldap/authentication_spec.rb
index ebaf8383ce5..1f8b1474539 100644
--- a/spec/lib/gitlab/auth/ldap/authentication_spec.rb
+++ b/spec/lib/gitlab/auth/ldap/authentication_spec.rb
@@ -2,15 +2,15 @@
require 'spec_helper'
-describe Gitlab::Auth::LDAP::Authentication do
+describe Gitlab::Auth::Ldap::Authentication do
let(:dn) { 'uid=John Smith, ou=People, dc=example, dc=com' }
- let(:user) { create(:omniauth_user, extern_uid: Gitlab::Auth::LDAP::Person.normalize_dn(dn)) }
+ let(:user) { create(:omniauth_user, extern_uid: Gitlab::Auth::Ldap::Person.normalize_dn(dn)) }
let(:login) { 'john' }
let(:password) { 'password' }
describe 'login' do
before do
- allow(Gitlab::Auth::LDAP::Config).to receive(:enabled?).and_return(true)
+ allow(Gitlab::Auth::Ldap::Config).to receive(:enabled?).and_return(true)
end
it "finds the user if authentication is successful" do
@@ -48,7 +48,7 @@ describe Gitlab::Auth::LDAP::Authentication do
end
it "fails if ldap is disabled" do
- allow(Gitlab::Auth::LDAP::Config).to receive(:enabled?).and_return(false)
+ allow(Gitlab::Auth::Ldap::Config).to receive(:enabled?).and_return(false)
expect(described_class.login(login, password)).to be_falsey
end
diff --git a/spec/lib/gitlab/auth/ldap/config_spec.rb b/spec/lib/gitlab/auth/ldap/config_spec.rb
index e4a90d4018d..0967c45d36b 100644
--- a/spec/lib/gitlab/auth/ldap/config_spec.rb
+++ b/spec/lib/gitlab/auth/ldap/config_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-describe Gitlab::Auth::LDAP::Config do
+describe Gitlab::Auth::Ldap::Config do
include LdapHelpers
let(:config) { described_class.new('ldapmain') }
diff --git a/spec/lib/gitlab/auth/ldap/dn_spec.rb b/spec/lib/gitlab/auth/ldap/dn_spec.rb
index 63656efba29..7aaffa52ae4 100644
--- a/spec/lib/gitlab/auth/ldap/dn_spec.rb
+++ b/spec/lib/gitlab/auth/ldap/dn_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-describe Gitlab::Auth::LDAP::DN do
+describe Gitlab::Auth::Ldap::DN do
using RSpec::Parameterized::TableSyntax
describe '#normalize_value' do
@@ -15,7 +15,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { 'John Smith,' }
it 'raises MalformedError' do
- expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, 'DN string ended unexpectedly')
+ expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, 'DN string ended unexpectedly')
end
end
@@ -23,7 +23,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { '#aa aa' }
it 'raises MalformedError' do
- expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, "Expected the end of an attribute value, but got \"a\"")
+ expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, "Expected the end of an attribute value, but got \"a\"")
end
end
@@ -31,7 +31,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { '#aaXaaa' }
it 'raises MalformedError' do
- expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, "Expected the first character of a hex pair, but got \"X\"")
+ expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, "Expected the first character of a hex pair, but got \"X\"")
end
end
@@ -39,7 +39,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { '#aaaYaa' }
it 'raises MalformedError' do
- expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, "Expected the second character of a hex pair, but got \"Y\"")
+ expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, "Expected the second character of a hex pair, but got \"Y\"")
end
end
@@ -47,7 +47,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { '"Sebasti\\cX\\a1n"' }
it 'raises MalformedError' do
- expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, "Expected the second character of a hex pair inside a double quoted value, but got \"X\"")
+ expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, "Expected the second character of a hex pair inside a double quoted value, but got \"X\"")
end
end
@@ -55,7 +55,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { '"James' }
it 'raises MalformedError' do
- expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, 'DN string ended unexpectedly')
+ expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, 'DN string ended unexpectedly')
end
end
@@ -63,7 +63,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { 'J\ames' }
it 'raises MalformedError' do
- expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, 'Invalid escaped hex code "\am"')
+ expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, 'Invalid escaped hex code "\am"')
end
end
@@ -71,7 +71,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { 'foo\\' }
it 'raises MalformedError' do
- expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, 'DN string ended unexpectedly')
+ expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, 'DN string ended unexpectedly')
end
end
end
@@ -88,7 +88,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { 'uid=john smith+telephonenumber=+1 555-555-5555,ou=people,dc=example,dc=com' }
it 'raises UnsupportedError' do
- expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::UnsupportedError)
+ expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::UnsupportedError)
end
end
@@ -97,7 +97,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { 'uid = John Smith + telephoneNumber = + 1 555-555-5555 , ou = People,dc=example,dc=com' }
it 'raises UnsupportedError' do
- expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::UnsupportedError)
+ expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::UnsupportedError)
end
end
@@ -105,7 +105,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { 'uid = John Smith + telephoneNumber = +1 555-555-5555 , ou = People,dc=example,dc=com' }
it 'raises UnsupportedError' do
- expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::UnsupportedError)
+ expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::UnsupportedError)
end
end
end
@@ -117,7 +117,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { 'uid=John Smith,' }
it 'raises MalformedError' do
- expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, 'DN string ended unexpectedly')
+ expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, 'DN string ended unexpectedly')
end
end
@@ -125,7 +125,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { '0.9.2342.19200300.100.1.25=#aa aa' }
it 'raises MalformedError' do
- expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, "Expected the end of an attribute value, but got \"a\"")
+ expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, "Expected the end of an attribute value, but got \"a\"")
end
end
@@ -133,7 +133,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { '0.9.2342.19200300.100.1.25=#aaXaaa' }
it 'raises MalformedError' do
- expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, "Expected the first character of a hex pair, but got \"X\"")
+ expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, "Expected the first character of a hex pair, but got \"X\"")
end
end
@@ -141,7 +141,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { '0.9.2342.19200300.100.1.25=#aaaYaa' }
it 'raises MalformedError' do
- expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, "Expected the second character of a hex pair, but got \"Y\"")
+ expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, "Expected the second character of a hex pair, but got \"Y\"")
end
end
@@ -149,7 +149,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { 'uid="Sebasti\\cX\\a1n"' }
it 'raises MalformedError' do
- expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, "Expected the second character of a hex pair inside a double quoted value, but got \"X\"")
+ expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, "Expected the second character of a hex pair inside a double quoted value, but got \"X\"")
end
end
@@ -157,7 +157,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { 'John' }
it 'raises MalformedError' do
- expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, 'DN string ended unexpectedly')
+ expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, 'DN string ended unexpectedly')
end
end
@@ -165,7 +165,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { 'cn="James' }
it 'raises MalformedError' do
- expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, 'DN string ended unexpectedly')
+ expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, 'DN string ended unexpectedly')
end
end
@@ -173,7 +173,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { 'cn=J\ames' }
it 'raises MalformedError' do
- expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, 'Invalid escaped hex code "\am"')
+ expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, 'Invalid escaped hex code "\am"')
end
end
@@ -181,7 +181,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { 'cn=\\' }
it 'raises MalformedError' do
- expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, 'DN string ended unexpectedly')
+ expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, 'DN string ended unexpectedly')
end
end
@@ -189,7 +189,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { '1.2.d=Value' }
it 'raises MalformedError' do
- expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, 'Unrecognized RDN OID attribute type name character "d"')
+ expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, 'Unrecognized RDN OID attribute type name character "d"')
end
end
@@ -197,7 +197,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { 'd1.2=Value' }
it 'raises MalformedError' do
- expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, 'Unrecognized RDN attribute type name character "."')
+ expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, 'Unrecognized RDN attribute type name character "."')
end
end
@@ -205,7 +205,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { ' -uid=John Smith' }
it 'raises MalformedError' do
- expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, 'Unrecognized first character of an RDN attribute type name "-"')
+ expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, 'Unrecognized first character of an RDN attribute type name "-"')
end
end
@@ -213,7 +213,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { 'uid\\=john' }
it 'raises MalformedError' do
- expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, 'Unrecognized RDN attribute type name character "\\"')
+ expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, 'Unrecognized RDN attribute type name character "\\"')
end
end
end
diff --git a/spec/lib/gitlab/auth/ldap/person_spec.rb b/spec/lib/gitlab/auth/ldap/person_spec.rb
index 985732e69f9..e90917cfce1 100644
--- a/spec/lib/gitlab/auth/ldap/person_spec.rb
+++ b/spec/lib/gitlab/auth/ldap/person_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-describe Gitlab::Auth::LDAP::Person do
+describe Gitlab::Auth::Ldap::Person do
include LdapHelpers
let(:entry) { ldap_user_entry('john.doe') }
@@ -61,7 +61,7 @@ describe Gitlab::Auth::LDAP::Person do
}
}
)
- config = Gitlab::Auth::LDAP::Config.new('ldapmain')
+ config = Gitlab::Auth::Ldap::Config.new('ldapmain')
ldap_attributes = described_class.ldap_attributes(config)
expect(ldap_attributes).to match_array(%w(dn uid cn mail memberof))
diff --git a/spec/lib/gitlab/auth/ldap/user_spec.rb b/spec/lib/gitlab/auth/ldap/user_spec.rb
index 071d687b2bf..867633e54df 100644
--- a/spec/lib/gitlab/auth/ldap/user_spec.rb
+++ b/spec/lib/gitlab/auth/ldap/user_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-describe Gitlab::Auth::LDAP::User do
+describe Gitlab::Auth::Ldap::User do
include LdapHelpers
let(:ldap_user) { described_class.new(auth_hash) }
diff --git a/spec/lib/gitlab/auth/o_auth/user_spec.rb b/spec/lib/gitlab/auth/o_auth/user_spec.rb
index 022a544395e..62b83ff8b88 100644
--- a/spec/lib/gitlab/auth/o_auth/user_spec.rb
+++ b/spec/lib/gitlab/auth/o_auth/user_spec.rb
@@ -22,7 +22,7 @@ describe Gitlab::Auth::OAuth::User do
}
}
end
- let(:ldap_user) { Gitlab::Auth::LDAP::Person.new(Net::LDAP::Entry.new, 'ldapmain') }
+ let(:ldap_user) { Gitlab::Auth::Ldap::Person.new(Net::LDAP::Entry.new, 'ldapmain') }
describe '#persisted?' do
let!(:existing_user) { create(:omniauth_user, extern_uid: 'my-uid', provider: 'my-provider') }
@@ -230,7 +230,7 @@ describe Gitlab::Auth::OAuth::User do
context "and no account for the LDAP user" do
before do
- allow(Gitlab::Auth::LDAP::Person).to receive(:find_by_uid).and_return(ldap_user)
+ allow(Gitlab::Auth::Ldap::Person).to receive(:find_by_uid).and_return(ldap_user)
oauth_user.save
end
@@ -269,7 +269,7 @@ describe Gitlab::Auth::OAuth::User do
let!(:existing_user) { create(:omniauth_user, name: 'John Doe', email: 'john@example.com', extern_uid: dn, provider: 'ldapmain', username: 'john') }
it "adds the omniauth identity to the LDAP account" do
- allow(Gitlab::Auth::LDAP::Person).to receive(:find_by_uid).and_return(ldap_user)
+ allow(Gitlab::Auth::Ldap::Person).to receive(:find_by_uid).and_return(ldap_user)
oauth_user.save
@@ -290,8 +290,8 @@ describe Gitlab::Auth::OAuth::User do
context 'when an LDAP person is not found by uid' do
it 'tries to find an LDAP person by email and adds the omniauth identity to the user' do
- allow(Gitlab::Auth::LDAP::Person).to receive(:find_by_uid).and_return(nil)
- allow(Gitlab::Auth::LDAP::Person).to receive(:find_by_email).and_return(ldap_user)
+ allow(Gitlab::Auth::Ldap::Person).to receive(:find_by_uid).and_return(nil)
+ allow(Gitlab::Auth::Ldap::Person).to receive(:find_by_email).and_return(ldap_user)
oauth_user.save
@@ -301,9 +301,9 @@ describe Gitlab::Auth::OAuth::User do
context 'when also not found by email' do
it 'tries to find an LDAP person by DN and adds the omniauth identity to the user' do
- allow(Gitlab::Auth::LDAP::Person).to receive(:find_by_uid).and_return(nil)
- allow(Gitlab::Auth::LDAP::Person).to receive(:find_by_email).and_return(nil)
- allow(Gitlab::Auth::LDAP::Person).to receive(:find_by_dn).and_return(ldap_user)
+ allow(Gitlab::Auth::Ldap::Person).to receive(:find_by_uid).and_return(nil)
+ allow(Gitlab::Auth::Ldap::Person).to receive(:find_by_email).and_return(nil)
+ allow(Gitlab::Auth::Ldap::Person).to receive(:find_by_dn).and_return(ldap_user)
oauth_user.save
@@ -344,7 +344,7 @@ describe Gitlab::Auth::OAuth::User do
context 'and no account for the LDAP user' do
it 'creates a user favoring the LDAP username and strips email domain' do
- allow(Gitlab::Auth::LDAP::Person).to receive(:find_by_uid).and_return(ldap_user)
+ allow(Gitlab::Auth::Ldap::Person).to receive(:find_by_uid).and_return(ldap_user)
oauth_user.save
@@ -356,7 +356,7 @@ describe Gitlab::Auth::OAuth::User do
context "and no corresponding LDAP person" do
before do
- allow(Gitlab::Auth::LDAP::Person).to receive(:find_by_uid).and_return(nil)
+ allow(Gitlab::Auth::Ldap::Person).to receive(:find_by_uid).and_return(nil)
end
include_examples "to verify compliance with allow_single_sign_on"
@@ -405,13 +405,13 @@ describe Gitlab::Auth::OAuth::User do
allow(ldap_user).to receive(:username) { uid }
allow(ldap_user).to receive(:email) { ['johndoe@example.com', 'john2@example.com'] }
allow(ldap_user).to receive(:dn) { dn }
- allow(Gitlab::Auth::LDAP::Person).to receive(:find_by_uid).and_return(ldap_user)
+ allow(Gitlab::Auth::Ldap::Person).to receive(:find_by_uid).and_return(ldap_user)
end
context "and no account for the LDAP user" do
context 'dont block on create (LDAP)' do
before do
- allow_next_instance_of(Gitlab::Auth::LDAP::Config) do |instance|
+ allow_next_instance_of(Gitlab::Auth::Ldap::Config) do |instance|
allow(instance).to receive_messages(block_auto_created_users: false)
end
end
@@ -425,7 +425,7 @@ describe Gitlab::Auth::OAuth::User do
context 'block on create (LDAP)' do
before do
- allow_next_instance_of(Gitlab::Auth::LDAP::Config) do |instance|
+ allow_next_instance_of(Gitlab::Auth::Ldap::Config) do |instance|
allow(instance).to receive_messages(block_auto_created_users: true)
end
end
@@ -443,7 +443,7 @@ describe Gitlab::Auth::OAuth::User do
context 'dont block on create (LDAP)' do
before do
- allow_next_instance_of(Gitlab::Auth::LDAP::Config) do |instance|
+ allow_next_instance_of(Gitlab::Auth::Ldap::Config) do |instance|
allow(instance).to receive_messages(block_auto_created_users: false)
end
end
@@ -457,7 +457,7 @@ describe Gitlab::Auth::OAuth::User do
context 'block on create (LDAP)' do
before do
- allow_next_instance_of(Gitlab::Auth::LDAP::Config) do |instance|
+ allow_next_instance_of(Gitlab::Auth::Ldap::Config) do |instance|
allow(instance).to receive_messages(block_auto_created_users: true)
end
end
@@ -503,7 +503,7 @@ describe Gitlab::Auth::OAuth::User do
context 'dont block on create (LDAP)' do
before do
- allow_next_instance_of(Gitlab::Auth::LDAP::Config) do |instance|
+ allow_next_instance_of(Gitlab::Auth::Ldap::Config) do |instance|
allow(instance).to receive_messages(block_auto_created_users: false)
end
end
@@ -517,7 +517,7 @@ describe Gitlab::Auth::OAuth::User do
context 'block on create (LDAP)' do
before do
- allow_next_instance_of(Gitlab::Auth::LDAP::Config) do |instance|
+ allow_next_instance_of(Gitlab::Auth::Ldap::Config) do |instance|
allow(instance).to receive_messages(block_auto_created_users: true)
end
end
@@ -806,7 +806,7 @@ describe Gitlab::Auth::OAuth::User do
end
it 'returns nil' do
- adapter = Gitlab::Auth::LDAP::Adapter.new('ldapmain')
+ adapter = Gitlab::Auth::Ldap::Adapter.new('ldapmain')
hash = OmniAuth::AuthHash.new(uid: 'whatever', provider: 'ldapmain')
expect(oauth_user.send(:find_ldap_person, hash, adapter)).to be_nil
diff --git a/spec/lib/gitlab/auth/saml/user_spec.rb b/spec/lib/gitlab/auth/saml/user_spec.rb
index 4c400636ddf..55d2f22b923 100644
--- a/spec/lib/gitlab/auth/saml/user_spec.rb
+++ b/spec/lib/gitlab/auth/saml/user_spec.rb
@@ -19,7 +19,7 @@ describe Gitlab::Auth::Saml::User do
email: 'john@mail.com'
}
end
- let(:ldap_user) { Gitlab::Auth::LDAP::Person.new(Net::LDAP::Entry.new, 'ldapmain') }
+ let(:ldap_user) { Gitlab::Auth::Ldap::Person.new(Net::LDAP::Entry.new, 'ldapmain') }
describe '#save' do
before do
@@ -161,10 +161,10 @@ describe Gitlab::Auth::Saml::User do
allow(ldap_user).to receive(:username) { uid }
allow(ldap_user).to receive(:email) { %w(john@mail.com john2@example.com) }
allow(ldap_user).to receive(:dn) { dn }
- allow(Gitlab::Auth::LDAP::Adapter).to receive(:new).and_return(adapter)
- allow(Gitlab::Auth::LDAP::Person).to receive(:find_by_uid).with(uid, adapter).and_return(ldap_user)
- allow(Gitlab::Auth::LDAP::Person).to receive(:find_by_dn).with(dn, adapter).and_return(ldap_user)
- allow(Gitlab::Auth::LDAP::Person).to receive(:find_by_email).with('john@mail.com', adapter).and_return(ldap_user)
+ allow(Gitlab::Auth::Ldap::Adapter).to receive(:new).and_return(adapter)
+ allow(Gitlab::Auth::Ldap::Person).to receive(:find_by_uid).with(uid, adapter).and_return(ldap_user)
+ allow(Gitlab::Auth::Ldap::Person).to receive(:find_by_dn).with(dn, adapter).and_return(ldap_user)
+ allow(Gitlab::Auth::Ldap::Person).to receive(:find_by_email).with('john@mail.com', adapter).and_return(ldap_user)
end
context 'and no account for the LDAP user' do
@@ -212,10 +212,10 @@ describe Gitlab::Auth::Saml::User do
nil_types = uid_types - [uid_type]
nil_types.each do |type|
- allow(Gitlab::Auth::LDAP::Person).to receive(:"find_by_#{type}").and_return(nil)
+ allow(Gitlab::Auth::Ldap::Person).to receive(:"find_by_#{type}").and_return(nil)
end
- allow(Gitlab::Auth::LDAP::Person).to receive(:"find_by_#{uid_type}").and_return(ldap_user)
+ allow(Gitlab::Auth::Ldap::Person).to receive(:"find_by_#{uid_type}").and_return(ldap_user)
end
it 'adds the omniauth identity to the LDAP account' do
@@ -282,7 +282,7 @@ describe Gitlab::Auth::Saml::User do
it 'adds the LDAP identity to the existing SAML user' do
create(:omniauth_user, email: 'john@mail.com', extern_uid: dn, provider: 'saml', username: 'john')
- allow(Gitlab::Auth::LDAP::Person).to receive(:find_by_uid).with(dn, adapter).and_return(ldap_user)
+ allow(Gitlab::Auth::Ldap::Person).to receive(:find_by_uid).with(dn, adapter).and_return(ldap_user)
local_hash = OmniAuth::AuthHash.new(uid: dn, provider: provider, info: info_hash)
local_saml_user = described_class.new(local_hash)
diff --git a/spec/lib/gitlab/auth_spec.rb b/spec/lib/gitlab/auth_spec.rb
index 209ba68ccbc..e0c1f830165 100644
--- a/spec/lib/gitlab/auth_spec.rb
+++ b/spec/lib/gitlab/auth_spec.rb
@@ -590,23 +590,23 @@ describe Gitlab::Auth, :use_clean_rails_memory_store_caching do
context "with ldap enabled" do
before do
- allow(Gitlab::Auth::LDAP::Config).to receive(:enabled?).and_return(true)
+ allow(Gitlab::Auth::Ldap::Config).to receive(:enabled?).and_return(true)
end
it "tries to autheticate with db before ldap" do
- expect(Gitlab::Auth::LDAP::Authentication).not_to receive(:login)
+ expect(Gitlab::Auth::Ldap::Authentication).not_to receive(:login)
expect(gl_auth.find_with_user_password(username, password)).to eq(user)
end
it "does not find user by using ldap as fallback to for authentication" do
- expect(Gitlab::Auth::LDAP::Authentication).to receive(:login).and_return(nil)
+ expect(Gitlab::Auth::Ldap::Authentication).to receive(:login).and_return(nil)
expect(gl_auth.find_with_user_password('ldap_user', 'password')).to be_nil
end
it "find new user by using ldap as fallback to for authentication" do
- expect(Gitlab::Auth::LDAP::Authentication).to receive(:login).and_return(user)
+ expect(Gitlab::Auth::Ldap::Authentication).to receive(:login).and_return(user)
expect(gl_auth.find_with_user_password('ldap_user', 'password')).to eq(user)
end
@@ -623,7 +623,7 @@ describe Gitlab::Auth, :use_clean_rails_memory_store_caching do
context "with ldap enabled" do
before do
- allow(Gitlab::Auth::LDAP::Config).to receive(:enabled?).and_return(true)
+ allow(Gitlab::Auth::Ldap::Config).to receive(:enabled?).and_return(true)
end
it "does not find non-ldap user by valid login/password" do
diff --git a/spec/lib/gitlab/bare_repository_import/repository_spec.rb b/spec/lib/gitlab/bare_repository_import/repository_spec.rb
index 0607e2232a1..d2ecb1869fc 100644
--- a/spec/lib/gitlab/bare_repository_import/repository_spec.rb
+++ b/spec/lib/gitlab/bare_repository_import/repository_spec.rb
@@ -54,16 +54,15 @@ describe ::Gitlab::BareRepositoryImport::Repository do
end
context 'hashed storage' do
- let(:gitlab_shell) { Gitlab::Shell.new }
- let(:repository_storage) { 'default' }
- let(:root_path) { Gitlab.config.repositories.storages[repository_storage].legacy_disk_path }
let(:hash) { '6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b' }
let(:hashed_path) { "@hashed/6b/86/6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b" }
+ let(:root_path) { TestEnv.repos_path }
let(:repo_path) { File.join(root_path, "#{hashed_path}.git") }
let(:wiki_path) { File.join(root_path, "#{hashed_path}.wiki.git") }
before do
- gitlab_shell.create_repository(repository_storage, hashed_path, 'group/project')
+ TestEnv.create_bare_repository(repo_path)
+
Gitlab::GitalyClient::StorageSettings.allow_disk_access do
repository = Rugged::Repository.new(repo_path)
repository.config['gitlab.fullpath'] = 'to/repo'
@@ -71,7 +70,7 @@ describe ::Gitlab::BareRepositoryImport::Repository do
end
after do
- gitlab_shell.remove_repository(repository_storage, hashed_path)
+ FileUtils.rm_rf(repo_path)
end
subject { described_class.new(root_path, repo_path) }
diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb
index a9d7beb0fea..d3daa7c0260 100644
--- a/spec/lib/gitlab/git/repository_spec.rb
+++ b/spec/lib/gitlab/git/repository_spec.rb
@@ -500,11 +500,11 @@ describe Gitlab::Git::Repository, :seed_helper do
subject { new_repository.fetch_repository_as_mirror(repository) }
before do
- Gitlab::Shell.new.create_repository('default', 'my_project', 'group/project')
+ new_repository.create_repository
end
after do
- Gitlab::Shell.new.remove_repository('default', 'my_project')
+ new_repository.remove
end
it 'fetches a repository as a mirror remote' do
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index b8abe698639..39a31801720 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -4197,7 +4197,7 @@ describe User, :do_not_mock_admin_mode do
describe '#read_only_attribute?' do
context 'when LDAP server is enabled' do
before do
- allow(Gitlab::Auth::LDAP::Config).to receive(:enabled?).and_return(true)
+ allow(Gitlab::Auth::Ldap::Config).to receive(:enabled?).and_return(true)
end
%i[name email location].each do |attribute|
diff --git a/spec/requests/git_http_spec.rb b/spec/requests/git_http_spec.rb
index 381ad45d477..183a3545cf2 100644
--- a/spec/requests/git_http_spec.rb
+++ b/spec/requests/git_http_spec.rb
@@ -639,8 +639,8 @@ describe 'Git HTTP requests' do
context 'when LDAP is configured' do
before do
- allow(Gitlab::Auth::LDAP::Config).to receive(:enabled?).and_return(true)
- allow_any_instance_of(Gitlab::Auth::LDAP::Authentication)
+ allow(Gitlab::Auth::Ldap::Config).to receive(:enabled?).and_return(true)
+ allow_any_instance_of(Gitlab::Auth::Ldap::Authentication)
.to receive(:login).and_return(nil)
end
@@ -862,8 +862,8 @@ describe 'Git HTTP requests' do
before do
allow(Gitlab::Auth::OAuth::Provider).to receive(:enabled?).and_return(true)
- allow_any_instance_of(Gitlab::Auth::LDAP::Authentication).to receive(:login).and_return(nil)
- allow_any_instance_of(Gitlab::Auth::LDAP::Authentication).to receive(:login).with(user.username, user.password).and_return(user)
+ allow_any_instance_of(Gitlab::Auth::Ldap::Authentication).to receive(:login).and_return(nil)
+ allow_any_instance_of(Gitlab::Auth::Ldap::Authentication).to receive(:login).with(user.username, user.password).and_return(user)
end
it_behaves_like 'pulls require Basic HTTP Authentication'
diff --git a/spec/services/projects/create_service_spec.rb b/spec/services/projects/create_service_spec.rb
index c5c16130edc..3c9914e2a89 100644
--- a/spec/services/projects/create_service_spec.rb
+++ b/spec/services/projects/create_service_spec.rb
@@ -6,7 +6,6 @@ describe Projects::CreateService, '#execute' do
include ExternalAuthorizationServiceHelpers
include GitHelpers
- let(:gitlab_shell) { Gitlab::Shell.new }
let(:user) { create :user }
let(:opts) do
{
@@ -264,8 +263,6 @@ describe Projects::CreateService, '#execute' do
end
context 'when another repository already exists on disk' do
- let(:repository_storage) { 'default' }
-
let(:opts) do
{
name: 'Existing',
@@ -274,13 +271,15 @@ describe Projects::CreateService, '#execute' do
end
context 'with legacy storage' do
+ let(:fake_repo_path) { File.join(TestEnv.repos_path, user.namespace.full_path, 'existing.git') }
+
before do
stub_application_setting(hashed_storage_enabled: false)
- gitlab_shell.create_repository(repository_storage, "#{user.namespace.full_path}/existing", 'group/project')
+ TestEnv.create_bare_repository(fake_repo_path)
end
after do
- gitlab_shell.remove_repository(repository_storage, "#{user.namespace.full_path}/existing")
+ FileUtils.rm_rf(fake_repo_path)
end
it 'does not allow to create a project when path matches existing repository on disk' do
@@ -305,17 +304,15 @@ describe Projects::CreateService, '#execute' do
context 'with hashed storage' do
let(:hash) { '6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b' }
let(:hashed_path) { '@hashed/6b/86/6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b' }
+ let(:fake_repo_path) { File.join(TestEnv.repos_path, "#{hashed_path}.git") }
before do
allow(Digest::SHA2).to receive(:hexdigest) { hash }
- end
-
- before do
- gitlab_shell.create_repository(repository_storage, hashed_path, 'group/project')
+ TestEnv.create_bare_repository(fake_repo_path)
end
after do
- gitlab_shell.remove_repository(repository_storage, hashed_path)
+ FileUtils.rm_rf(fake_repo_path)
end
it 'does not allow to create a project when path matches existing repository on disk' do
diff --git a/spec/services/projects/fork_service_spec.rb b/spec/services/projects/fork_service_spec.rb
index cbf7a135c41..4e5f10b3947 100644
--- a/spec/services/projects/fork_service_spec.rb
+++ b/spec/services/projects/fork_service_spec.rb
@@ -4,7 +4,6 @@ require 'spec_helper'
describe Projects::ForkService do
include ProjectForksHelper
- include Gitlab::ShellAdapter
shared_examples 'forks count cache refresh' do
it 'flushes the forks count cache of the source project', :clean_gitlab_redis_cache do
@@ -135,17 +134,16 @@ describe Projects::ForkService do
end
context 'repository in legacy storage already exists' do
- let(:repository_storage) { 'default' }
- let(:repository_storage_path) { Gitlab.config.repositories.storages[repository_storage].legacy_disk_path }
+ let(:fake_repo_path) { File.join(TestEnv.repos_path, @to_user.namespace.full_path, "#{@from_project.path}.git") }
let(:params) { { namespace: @to_user.namespace } }
before do
stub_application_setting(hashed_storage_enabled: false)
- gitlab_shell.create_repository(repository_storage, "#{@to_user.namespace.full_path}/#{@from_project.path}", "#{@to_user.namespace.full_path}/#{@from_project.path}")
+ TestEnv.create_bare_repository(fake_repo_path)
end
after do
- gitlab_shell.remove_repository(repository_storage, "#{@to_user.namespace.full_path}/#{@from_project.path}")
+ FileUtils.rm_rf(fake_repo_path)
end
subject { fork_project(@from_project, @to_user, params) }
diff --git a/spec/services/projects/transfer_service_spec.rb b/spec/services/projects/transfer_service_spec.rb
index fe31dafdd03..f17ddb22d22 100644
--- a/spec/services/projects/transfer_service_spec.rb
+++ b/spec/services/projects/transfer_service_spec.rb
@@ -5,7 +5,6 @@ require 'spec_helper'
describe Projects::TransferService do
include GitHelpers
- let(:gitlab_shell) { Gitlab::Shell.new }
let(:user) { create(:user) }
let(:group) { create(:group) }
let(:project) { create(:project, :repository, :legacy_storage, namespace: user.namespace) }
@@ -104,7 +103,7 @@ describe Projects::TransferService do
it 'rolls back repo location' do
attempt_project_transfer
- expect(gitlab_shell.repository_exists?(project.repository_storage, "#{project.disk_path}.git")).to be(true)
+ expect(project.repository.raw.exists?).to be(true)
expect(original_path).to eq current_path
end
@@ -172,21 +171,18 @@ describe Projects::TransferService do
end
context 'namespace which contains orphan repository with same projects path name' do
- let(:repository_storage) { 'default' }
- let(:repository_storage_path) { Gitlab.config.repositories.storages[repository_storage].legacy_disk_path }
+ let(:fake_repo_path) { File.join(TestEnv.repos_path, group.full_path, "#{project.path}.git") }
before do
group.add_owner(user)
- unless gitlab_shell.create_repository(repository_storage, "#{group.full_path}/#{project.path}", project.full_path)
- raise 'failed to add repository'
- end
+ TestEnv.create_bare_repository(fake_repo_path)
@result = transfer_project(project, user, group)
end
after do
- gitlab_shell.remove_repository(repository_storage, "#{group.full_path}/#{project.path}")
+ FileUtils.rm_rf(fake_repo_path)
end
it { expect(@result).to eq false }
diff --git a/spec/services/projects/update_service_spec.rb b/spec/services/projects/update_service_spec.rb
index 8b5b6e5ac4e..ce9765a36ba 100644
--- a/spec/services/projects/update_service_spec.rb
+++ b/spec/services/projects/update_service_spec.rb
@@ -12,7 +12,6 @@ describe Projects::UpdateService do
end
describe '#execute' do
- let(:gitlab_shell) { Gitlab::Shell.new }
let(:admin) { create(:admin) }
context 'when changing visibility level' do
@@ -303,18 +302,17 @@ describe Projects::UpdateService do
end
context 'when renaming a project' do
- let(:repository_storage) { 'default' }
- let(:repository_storage_path) { Gitlab.config.repositories.storages[repository_storage].legacy_disk_path }
+ let(:fake_repo_path) { File.join(TestEnv.repos_path, user.namespace.full_path, 'existing.git') }
context 'with legacy storage' do
let(:project) { create(:project, :legacy_storage, :repository, creator: user, namespace: user.namespace) }
before do
- gitlab_shell.create_repository(repository_storage, "#{user.namespace.full_path}/existing", user.namespace.full_path)
+ TestEnv.create_bare_repository(fake_repo_path)
end
after do
- gitlab_shell.remove_repository(repository_storage, "#{user.namespace.full_path}/existing")
+ FileUtils.rm_rf(fake_repo_path)
end
it 'does not allow renaming when new path matches existing repository on disk' do
diff --git a/spec/support/helpers/ldap_helpers.rb b/spec/support/helpers/ldap_helpers.rb
index 0549c56c753..8154e3a4fc9 100644
--- a/spec/support/helpers/ldap_helpers.rb
+++ b/spec/support/helpers/ldap_helpers.rb
@@ -2,14 +2,14 @@
module LdapHelpers
def ldap_adapter(provider = 'ldapmain', ldap = double(:ldap))
- ::Gitlab::Auth::LDAP::Adapter.new(provider, ldap)
+ ::Gitlab::Auth::Ldap::Adapter.new(provider, ldap)
end
def user_dn(uid)
"uid=#{uid},ou=users,dc=example,dc=com"
end
- # Accepts a hash of Gitlab::Auth::LDAP::Config keys and values.
+ # Accepts a hash of Gitlab::Auth::Ldap::Config keys and values.
#
# Example:
# stub_ldap_config(
@@ -17,7 +17,7 @@ module LdapHelpers
# admin_group: 'my-admin-group'
# )
def stub_ldap_config(messages)
- allow_any_instance_of(::Gitlab::Auth::LDAP::Config).to receive_messages(messages)
+ allow_any_instance_of(::Gitlab::Auth::Ldap::Config).to receive_messages(messages)
end
def stub_ldap_setting(messages)
@@ -28,29 +28,29 @@ module LdapHelpers
# `entry` to simulate when an LDAP person is not found
#
# Example:
- # adapter = ::Gitlab::Auth::LDAP::Adapter.new('ldapmain', double(:ldap))
+ # adapter = ::Gitlab::Auth::Ldap::Adapter.new('ldapmain', double(:ldap))
# ldap_user_entry = ldap_user_entry('john_doe')
#
# stub_ldap_person_find_by_uid('john_doe', ldap_user_entry, adapter)
def stub_ldap_person_find_by_uid(uid, entry, provider = 'ldapmain')
- return_value = ::Gitlab::Auth::LDAP::Person.new(entry, provider) if entry.present?
+ return_value = ::Gitlab::Auth::Ldap::Person.new(entry, provider) if entry.present?
- allow(::Gitlab::Auth::LDAP::Person)
+ allow(::Gitlab::Auth::Ldap::Person)
.to receive(:find_by_uid).with(uid, any_args).and_return(return_value)
end
def stub_ldap_person_find_by_dn(entry, provider = 'ldapmain')
- person = ::Gitlab::Auth::LDAP::Person.new(entry, provider) if entry.present?
+ person = ::Gitlab::Auth::Ldap::Person.new(entry, provider) if entry.present?
- allow(::Gitlab::Auth::LDAP::Person)
+ allow(::Gitlab::Auth::Ldap::Person)
.to receive(:find_by_dn)
.and_return(person)
end
def stub_ldap_person_find_by_email(email, entry, provider = 'ldapmain')
- person = ::Gitlab::Auth::LDAP::Person.new(entry, provider) if entry.present?
+ person = ::Gitlab::Auth::Ldap::Person.new(entry, provider) if entry.present?
- allow(::Gitlab::Auth::LDAP::Person)
+ allow(::Gitlab::Auth::Ldap::Person)
.to receive(:find_by_email)
.with(email, anything)
.and_return(person)
@@ -66,8 +66,8 @@ module LdapHelpers
end
def raise_ldap_connection_error
- allow_any_instance_of(Gitlab::Auth::LDAP::Adapter)
- .to receive(:ldap_search).and_raise(Gitlab::Auth::LDAP::LDAPConnectionError)
+ allow_any_instance_of(Gitlab::Auth::Ldap::Adapter)
+ .to receive(:ldap_search).and_raise(Gitlab::Auth::Ldap::LdapConnectionError)
end
end
diff --git a/spec/support/shared_contexts/controllers/ldap_omniauth_callbacks_controller_shared_context.rb b/spec/support/shared_contexts/controllers/ldap_omniauth_callbacks_controller_shared_context.rb
index 4426d3af908..8635c9a8ff9 100644
--- a/spec/support/shared_contexts/controllers/ldap_omniauth_callbacks_controller_shared_context.rb
+++ b/spec/support/shared_contexts/controllers/ldap_omniauth_callbacks_controller_shared_context.rb
@@ -30,7 +30,7 @@ RSpec.shared_context 'Ldap::OmniauthCallbacksController' do
@original_env_config_omniauth_auth = mock_auth_hash(provider.to_s, uid, user.email)
stub_omniauth_provider(provider, context: request)
- allow(Gitlab::Auth::LDAP::Access).to receive(:allowed?).and_return(valid_login?)
+ allow(Gitlab::Auth::Ldap::Access).to receive(:allowed?).and_return(valid_login?)
end
after do
diff --git a/spec/tasks/gitlab/check_rake_spec.rb b/spec/tasks/gitlab/check_rake_spec.rb
index b3c8ca03aec..e3e2a22add9 100644
--- a/spec/tasks/gitlab/check_rake_spec.rb
+++ b/spec/tasks/gitlab/check_rake_spec.rb
@@ -68,8 +68,8 @@ describe 'check.rake' do
context 'when LDAP is not enabled' do
it 'does not attempt to bind or search for users' do
- expect(Gitlab::Auth::LDAP::Config).not_to receive(:providers)
- expect(Gitlab::Auth::LDAP::Adapter).not_to receive(:open)
+ expect(Gitlab::Auth::Ldap::Config).not_to receive(:providers)
+ expect(Gitlab::Auth::Ldap::Adapter).not_to receive(:open)
subject
end
@@ -80,12 +80,12 @@ describe 'check.rake' do
let(:adapter) { ldap_adapter('ldapmain', ldap) }
before do
- allow(Gitlab::Auth::LDAP::Config)
+ allow(Gitlab::Auth::Ldap::Config)
.to receive_messages(
enabled?: true,
providers: ['ldapmain']
)
- allow(Gitlab::Auth::LDAP::Adapter).to receive(:open).and_yield(adapter)
+ allow(Gitlab::Auth::Ldap::Adapter).to receive(:open).and_yield(adapter)
allow(adapter).to receive(:users).and_return([])
end
diff --git a/spec/workers/post_receive_spec.rb b/spec/workers/post_receive_spec.rb
index 2a2d0f5a857..ac17919d7f0 100644
--- a/spec/workers/post_receive_spec.rb
+++ b/spec/workers/post_receive_spec.rb
@@ -421,24 +421,6 @@ describe PostReceive do
perform
end
end
-
- it 'updates the snippet db information' do
- blob = snippet.blobs.first
-
- expect(snippet).to receive(:update).with(file_name: blob.path, content: blob.data)
-
- perform
- end
-
- context 'when snippet does not have any blob' do
- it 'does not update snippet db information' do
- allow(snippet).to receive(:blobs).and_return([])
-
- expect(snippet).not_to receive(:update)
-
- perform
- end
- end
end
end