diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-05 09:12:53 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-05 09:12:53 +0300 |
commit | 6d706d5dc036fb40f4d7b8e6619c3c78335620aa (patch) | |
tree | d29a01e9e54b831bc97d8defe122c3eaf8038551 /spec | |
parent | ee231234eb70b3a40d95c4874c6d6d1b2ca0a39d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
16 files changed, 270 insertions, 259 deletions
diff --git a/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb b/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb index 2a7ebac771d..4335b1bbe57 100644 --- a/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb +++ b/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb @@ -30,8 +30,10 @@ RSpec.describe 'Resolving all open threads in a merge request from an issue', :j end it 'shows a button to resolve all threads by creating a new issue' do + find('.discussions-counter .dropdown-toggle').click + within('.discussions-counter') do - expect(page).to have_selector resolve_all_discussions_link_selector( title: "Create issue to resolve all threads" ) + expect(page).to have_link(_("Create issue to resolve all threads"), href: new_project_issue_path(project, merge_request_to_resolve_discussions_of: merge_request.iid)) end end @@ -48,6 +50,7 @@ RSpec.describe 'Resolving all open threads in a merge request from an issue', :j context 'creating an issue for threads' do before do + find('.discussions-counter .dropdown-toggle').click find(resolve_all_discussions_link_selector).click end diff --git a/spec/frontend/notes/components/discussion_counter_spec.js b/spec/frontend/notes/components/discussion_counter_spec.js index a7e2f1efa09..f4ec7f835bb 100644 --- a/spec/frontend/notes/components/discussion_counter_spec.js +++ b/spec/frontend/notes/components/discussion_counter_spec.js @@ -1,5 +1,5 @@ -import { GlButton } from '@gitlab/ui'; -import { shallowMount } from '@vue/test-utils'; +import { GlDropdownItem } from '@gitlab/ui'; +import { mount } from '@vue/test-utils'; import Vue, { nextTick } from 'vue'; import Vuex from 'vuex'; import DiscussionCounter from '~/notes/components/discussion_counter.vue'; @@ -45,7 +45,7 @@ describe('DiscussionCounter component', () => { describe('has no discussions', () => { it('does not render', () => { - wrapper = shallowMount(DiscussionCounter, { store, propsData: { blocksMerge: true } }); + wrapper = mount(DiscussionCounter, { store, propsData: { blocksMerge: true } }); expect(wrapper.findComponent({ ref: 'discussionCounter' }).exists()).toBe(false); }); @@ -55,7 +55,7 @@ describe('DiscussionCounter component', () => { it('does not render', () => { store.commit(types.ADD_OR_UPDATE_DISCUSSIONS, [{ ...discussionMock, resolvable: false }]); store.dispatch('updateResolvableDiscussionsCounts'); - wrapper = shallowMount(DiscussionCounter, { store, propsData: { blocksMerge: true } }); + wrapper = mount(DiscussionCounter, { store, propsData: { blocksMerge: true } }); expect(wrapper.findComponent({ ref: 'discussionCounter' }).exists()).toBe(false); }); @@ -75,7 +75,7 @@ describe('DiscussionCounter component', () => { it('renders', () => { updateStore(); - wrapper = shallowMount(DiscussionCounter, { store, propsData: { blocksMerge: true } }); + wrapper = mount(DiscussionCounter, { store, propsData: { blocksMerge: true } }); expect(wrapper.findComponent({ ref: 'discussionCounter' }).exists()).toBe(true); }); @@ -89,7 +89,7 @@ describe('DiscussionCounter component', () => { ({ blocksMerge, color }) => { updateStore(); store.state.unresolvedDiscussionsCount = 1; - wrapper = shallowMount(DiscussionCounter, { store, propsData: { blocksMerge } }); + wrapper = mount(DiscussionCounter, { store, propsData: { blocksMerge } }); expect(wrapper.find('[data-testid="discussions-counter-text"]').classes()).toContain(color); }, @@ -97,60 +97,58 @@ describe('DiscussionCounter component', () => { it.each` title | resolved | groupLength - ${'not allResolved'} | ${false} | ${4} + ${'not allResolved'} | ${false} | ${2} ${'allResolved'} | ${true} | ${1} - `('renders correctly if $title', ({ resolved, groupLength }) => { + `('renders correctly if $title', async ({ resolved, groupLength }) => { updateStore({ resolvable: true, resolved }); - wrapper = shallowMount(DiscussionCounter, { store, propsData: { blocksMerge: true } }); + wrapper = mount(DiscussionCounter, { store, propsData: { blocksMerge: true } }); + await wrapper.find('.dropdown-toggle').trigger('click'); - expect(wrapper.findAllComponents(GlButton)).toHaveLength(groupLength); + expect(wrapper.findAllComponents(GlDropdownItem)).toHaveLength(groupLength); }); }); describe('toggle all threads button', () => { let toggleAllButton; - const updateStoreWithExpanded = (expanded) => { + const updateStoreWithExpanded = async (expanded) => { const discussion = { ...discussionMock, expanded }; store.commit(types.ADD_OR_UPDATE_DISCUSSIONS, [discussion]); store.dispatch('updateResolvableDiscussionsCounts'); - wrapper = shallowMount(DiscussionCounter, { store, propsData: { blocksMerge: true } }); - toggleAllButton = wrapper.find('.toggle-all-discussions-btn'); + wrapper = mount(DiscussionCounter, { store, propsData: { blocksMerge: true } }); + await wrapper.find('.dropdown-toggle').trigger('click'); + toggleAllButton = wrapper.find('[data-testid="toggle-all-discussions-btn"]'); }; afterEach(() => wrapper.destroy()); - it('calls button handler when clicked', () => { - updateStoreWithExpanded(true); + it('calls button handler when clicked', async () => { + await updateStoreWithExpanded(true); - toggleAllButton.vm.$emit('click'); + toggleAllButton.trigger('click'); expect(setExpandDiscussionsFn).toHaveBeenCalledTimes(1); }); it('collapses all discussions if expanded', async () => { - updateStoreWithExpanded(true); + await updateStoreWithExpanded(true); expect(wrapper.vm.allExpanded).toBe(true); - expect(toggleAllButton.props('icon')).toBe('collapse'); - toggleAllButton.vm.$emit('click'); + toggleAllButton.trigger('click'); await nextTick(); expect(wrapper.vm.allExpanded).toBe(false); - expect(toggleAllButton.props('icon')).toBe('expand'); }); it('expands all discussions if collapsed', async () => { - updateStoreWithExpanded(false); + await updateStoreWithExpanded(false); expect(wrapper.vm.allExpanded).toBe(false); - expect(toggleAllButton.props('icon')).toBe('expand'); - toggleAllButton.vm.$emit('click'); + toggleAllButton.trigger('click'); await nextTick(); expect(wrapper.vm.allExpanded).toBe(true); - expect(toggleAllButton.props('icon')).toBe('collapse'); }); }); }); diff --git a/spec/lib/backup/gitaly_backup_spec.rb b/spec/lib/backup/gitaly_backup_spec.rb index d427e41026e..6b0747735ed 100644 --- a/spec/lib/backup/gitaly_backup_spec.rb +++ b/spec/lib/backup/gitaly_backup_spec.rb @@ -17,7 +17,7 @@ RSpec.describe Backup::GitalyBackup do let(:expected_env) do { 'SSL_CERT_FILE' => Gitlab::X509::Certificate.default_cert_file, - 'SSL_CERT_DIR' => Gitlab::X509::Certificate.default_cert_dir + 'SSL_CERT_DIR' => Gitlab::X509::Certificate.default_cert_dir }.merge(ENV) end @@ -121,7 +121,7 @@ RSpec.describe Backup::GitalyBackup do let(:ssl_env) do { 'SSL_CERT_FILE' => '/some/cert/file', - 'SSL_CERT_DIR' => '/some/cert' + 'SSL_CERT_DIR' => '/some/cert' } end diff --git a/spec/lib/banzai/filter/repository_link_filter_spec.rb b/spec/lib/banzai/filter/repository_link_filter_spec.rb index 815053aac2f..c220263b238 100644 --- a/spec/lib/banzai/filter/repository_link_filter_spec.rb +++ b/spec/lib/banzai/filter/repository_link_filter_spec.rb @@ -8,14 +8,14 @@ RSpec.describe Banzai::Filter::RepositoryLinkFilter do def filter(doc, contexts = {}) contexts.reverse_merge!({ - commit: commit, - project: project, - current_user: user, - group: group, - wiki: wiki, - ref: ref, + commit: commit, + project: project, + current_user: user, + group: group, + wiki: wiki, + ref: ref, requested_path: requested_path, - only_path: only_path + only_path: only_path }) described_class.call(doc, contexts) diff --git a/spec/lib/gitlab/asciidoc_spec.rb b/spec/lib/gitlab/asciidoc_spec.rb index b2bce2076b0..8fec8bce23e 100644 --- a/spec/lib/gitlab/asciidoc_spec.rb +++ b/spec/lib/gitlab/asciidoc_spec.rb @@ -638,9 +638,9 @@ module Gitlab context 'with project' do let(:context) do { - commit: commit, - project: project, - ref: ref, + commit: commit, + project: project, + ref: ref, requested_path: requested_path } end diff --git a/spec/lib/gitlab/auth/ldap/auth_hash_spec.rb b/spec/lib/gitlab/auth/ldap/auth_hash_spec.rb index 9dff7f7b3dc..e8008aeaf57 100644 --- a/spec/lib/gitlab/auth/ldap/auth_hash_spec.rb +++ b/spec/lib/gitlab/auth/ldap/auth_hash_spec.rb @@ -20,17 +20,17 @@ RSpec.describe Gitlab::Auth::Ldap::AuthHash do let(:info) do { - name: 'Smith, J.', - email: 'johnsmith@example.com', + name: 'Smith, J.', + email: 'johnsmith@example.com', nickname: '123456' } end let(:raw_info) do { - uid: ['123456'], - email: ['johnsmith@example.com'], - cn: ['Smith, J.'], + uid: ['123456'], + email: ['johnsmith@example.com'], + cn: ['Smith, J.'], fullName: ['John Smith'] } end @@ -52,8 +52,8 @@ RSpec.describe Gitlab::Auth::Ldap::AuthHash do let(:attributes) do { - 'username' => %w(mail email), - 'name' => 'fullName' + 'username' => %w(mail email), + 'name' => 'fullName' } end diff --git a/spec/lib/gitlab/auth/ldap/config_spec.rb b/spec/lib/gitlab/auth/ldap/config_spec.rb index 3039fce6141..3be983857bc 100644 --- a/spec/lib/gitlab/auth/ldap/config_spec.rb +++ b/spec/lib/gitlab/auth/ldap/config_spec.rb @@ -112,8 +112,8 @@ AtlErSqafbECNDSwS5BX8yDpu5yRBJ4xegO/rNlmb8ICRYkuJapD1xXicFOsmfUK it 'constructs basic options' do stub_ldap_config( options: { - 'host' => 'ldap.example.com', - 'port' => 386, + 'host' => 'ldap.example.com', + 'port' => 386, 'encryption' => 'plain' } ) @@ -129,16 +129,16 @@ AtlErSqafbECNDSwS5BX8yDpu5yRBJ4xegO/rNlmb8ICRYkuJapD1xXicFOsmfUK it 'includes failover hosts when set' do stub_ldap_config( options: { - 'host' => 'ldap.example.com', - 'port' => 686, - 'hosts' => [ + 'host' => 'ldap.example.com', + 'port' => 686, + 'hosts' => [ ['ldap1.example.com', 636], ['ldap2.example.com', 636] ], - 'encryption' => 'simple_tls', + 'encryption' => 'simple_tls', 'verify_certificates' => true, - 'bind_dn' => 'uid=admin,dc=example,dc=com', - 'password' => 'super_secret' + 'bind_dn' => 'uid=admin,dc=example,dc=com', + 'password' => 'super_secret' } ) @@ -158,12 +158,12 @@ AtlErSqafbECNDSwS5BX8yDpu5yRBJ4xegO/rNlmb8ICRYkuJapD1xXicFOsmfUK it 'includes authentication options when auth is configured' do stub_ldap_config( options: { - 'host' => 'ldap.example.com', - 'port' => 686, - 'encryption' => 'simple_tls', + 'host' => 'ldap.example.com', + 'port' => 686, + 'encryption' => 'simple_tls', 'verify_certificates' => true, - 'bind_dn' => 'uid=admin,dc=example,dc=com', - 'password' => 'super_secret' + 'bind_dn' => 'uid=admin,dc=example,dc=com', + 'password' => 'super_secret' } ) @@ -179,9 +179,9 @@ AtlErSqafbECNDSwS5BX8yDpu5yRBJ4xegO/rNlmb8ICRYkuJapD1xXicFOsmfUK it 'sets encryption method to simple_tls when configured as simple_tls' do stub_ldap_config( options: { - 'host' => 'ldap.example.com', - 'port' => 686, - 'encryption' => 'simple_tls' + 'host' => 'ldap.example.com', + 'port' => 686, + 'encryption' => 'simple_tls' } ) @@ -191,9 +191,9 @@ AtlErSqafbECNDSwS5BX8yDpu5yRBJ4xegO/rNlmb8ICRYkuJapD1xXicFOsmfUK it 'sets encryption method to start_tls when configured as start_tls' do stub_ldap_config( options: { - 'host' => 'ldap.example.com', - 'port' => 686, - 'encryption' => 'start_tls' + 'host' => 'ldap.example.com', + 'port' => 686, + 'encryption' => 'start_tls' } ) @@ -203,12 +203,12 @@ AtlErSqafbECNDSwS5BX8yDpu5yRBJ4xegO/rNlmb8ICRYkuJapD1xXicFOsmfUK it 'transforms SSL cert and key to OpenSSL objects' do stub_ldap_config( options: { - 'host' => 'ldap.example.com', - 'port' => 686, - 'encryption' => 'start_tls', - 'tls_options' => { - 'cert' => raw_cert, - 'key' => raw_key + 'host' => 'ldap.example.com', + 'port' => 686, + 'encryption' => 'start_tls', + 'tls_options' => { + 'cert' => raw_cert, + 'key' => raw_key } } ) @@ -221,12 +221,12 @@ AtlErSqafbECNDSwS5BX8yDpu5yRBJ4xegO/rNlmb8ICRYkuJapD1xXicFOsmfUK allow(Gitlab::AppLogger).to receive(:error) stub_ldap_config( options: { - 'host' => 'ldap.example.com', - 'port' => 686, - 'encryption' => 'start_tls', - 'tls_options' => { - 'cert' => 'invalid cert', - 'key' => 'invalid_key' + 'host' => 'ldap.example.com', + 'port' => 686, + 'encryption' => 'start_tls', + 'tls_options' => { + 'cert' => 'invalid cert', + 'key' => 'invalid_key' } } ) @@ -240,9 +240,9 @@ AtlErSqafbECNDSwS5BX8yDpu5yRBJ4xegO/rNlmb8ICRYkuJapD1xXicFOsmfUK it 'sets tls_options to OpenSSL defaults' do stub_ldap_config( options: { - 'host' => 'ldap.example.com', - 'port' => 686, - 'encryption' => 'simple_tls', + 'host' => 'ldap.example.com', + 'port' => 686, + 'encryption' => 'simple_tls', 'verify_certificates' => true } ) @@ -255,9 +255,9 @@ AtlErSqafbECNDSwS5BX8yDpu5yRBJ4xegO/rNlmb8ICRYkuJapD1xXicFOsmfUK it 'sets verify_mode to OpenSSL VERIFY_NONE' do stub_ldap_config( options: { - 'host' => 'ldap.example.com', - 'port' => 686, - 'encryption' => 'simple_tls', + 'host' => 'ldap.example.com', + 'port' => 686, + 'encryption' => 'simple_tls', 'verify_certificates' => false } ) @@ -274,11 +274,11 @@ AtlErSqafbECNDSwS5BX8yDpu5yRBJ4xegO/rNlmb8ICRYkuJapD1xXicFOsmfUK it 'passes it through in tls_options' do stub_ldap_config( options: { - 'host' => 'ldap.example.com', - 'port' => 686, - 'encryption' => 'simple_tls', - 'tls_options' => { - 'ca_file' => '/etc/ca.pem' + 'host' => 'ldap.example.com', + 'port' => 686, + 'encryption' => 'simple_tls', + 'tls_options' => { + 'ca_file' => '/etc/ca.pem' } } ) @@ -291,11 +291,11 @@ AtlErSqafbECNDSwS5BX8yDpu5yRBJ4xegO/rNlmb8ICRYkuJapD1xXicFOsmfUK it 'does not add the ca_file key to tls_options' do stub_ldap_config( options: { - 'host' => 'ldap.example.com', - 'port' => 686, - 'encryption' => 'simple_tls', - 'tls_options' => { - 'ca_file' => ' ' + 'host' => 'ldap.example.com', + 'port' => 686, + 'encryption' => 'simple_tls', + 'tls_options' => { + 'ca_file' => ' ' } } ) @@ -308,11 +308,11 @@ AtlErSqafbECNDSwS5BX8yDpu5yRBJ4xegO/rNlmb8ICRYkuJapD1xXicFOsmfUK it 'passes it through in tls_options' do stub_ldap_config( options: { - 'host' => 'ldap.example.com', - 'port' => 686, - 'encryption' => 'simple_tls', - 'tls_options' => { - 'ssl_version' => 'TLSv1_2' + 'host' => 'ldap.example.com', + 'port' => 686, + 'encryption' => 'simple_tls', + 'tls_options' => { + 'ssl_version' => 'TLSv1_2' } } ) @@ -325,11 +325,11 @@ AtlErSqafbECNDSwS5BX8yDpu5yRBJ4xegO/rNlmb8ICRYkuJapD1xXicFOsmfUK it 'does not add the ssl_version key to tls_options' do stub_ldap_config( options: { - 'host' => 'ldap.example.com', - 'port' => 686, - 'encryption' => 'simple_tls', - 'tls_options' => { - 'ssl_version' => ' ' + 'host' => 'ldap.example.com', + 'port' => 686, + 'encryption' => 'simple_tls', + 'tls_options' => { + 'ssl_version' => ' ' } } ) @@ -343,11 +343,11 @@ AtlErSqafbECNDSwS5BX8yDpu5yRBJ4xegO/rNlmb8ICRYkuJapD1xXicFOsmfUK it 'constructs basic options' do stub_ldap_config( options: { - 'host' => 'ldap.example.com', - 'port' => 386, - 'base' => 'ou=users,dc=example,dc=com', + 'host' => 'ldap.example.com', + 'port' => 386, + 'base' => 'ou=users,dc=example,dc=com', 'encryption' => 'plain', - 'uid' => 'uid' + 'uid' => 'uid' } ) @@ -364,10 +364,10 @@ AtlErSqafbECNDSwS5BX8yDpu5yRBJ4xegO/rNlmb8ICRYkuJapD1xXicFOsmfUK it 'includes authentication options when auth is configured' do stub_ldap_config( options: { - 'uid' => 'sAMAccountName', + 'uid' => 'sAMAccountName', 'user_filter' => '(memberOf=cn=group1,ou=groups,dc=example,dc=com)', - 'bind_dn' => 'uid=admin,dc=example,dc=com', - 'password' => 'super_secret' + 'bind_dn' => 'uid=admin,dc=example,dc=com', + 'password' => 'super_secret' } ) @@ -381,12 +381,12 @@ AtlErSqafbECNDSwS5BX8yDpu5yRBJ4xegO/rNlmb8ICRYkuJapD1xXicFOsmfUK it 'transforms SSL cert and key to OpenSSL objects' do stub_ldap_config( options: { - 'host' => 'ldap.example.com', - 'port' => 686, - 'encryption' => 'start_tls', - 'tls_options' => { - 'cert' => raw_cert, - 'key' => raw_key + 'host' => 'ldap.example.com', + 'port' => 686, + 'encryption' => 'start_tls', + 'tls_options' => { + 'cert' => raw_cert, + 'key' => raw_key } } ) @@ -399,9 +399,9 @@ AtlErSqafbECNDSwS5BX8yDpu5yRBJ4xegO/rNlmb8ICRYkuJapD1xXicFOsmfUK it 'specifies disable_verify_certificates as false' do stub_ldap_config( options: { - 'host' => 'ldap.example.com', - 'port' => 686, - 'encryption' => 'simple_tls', + 'host' => 'ldap.example.com', + 'port' => 686, + 'encryption' => 'simple_tls', 'verify_certificates' => true } ) @@ -414,9 +414,9 @@ AtlErSqafbECNDSwS5BX8yDpu5yRBJ4xegO/rNlmb8ICRYkuJapD1xXicFOsmfUK it 'specifies disable_verify_certificates as true' do stub_ldap_config( options: { - 'host' => 'ldap.example.com', - 'port' => 686, - 'encryption' => 'simple_tls', + 'host' => 'ldap.example.com', + 'port' => 686, + 'encryption' => 'simple_tls', 'verify_certificates' => false } ) @@ -429,12 +429,12 @@ AtlErSqafbECNDSwS5BX8yDpu5yRBJ4xegO/rNlmb8ICRYkuJapD1xXicFOsmfUK it 'passes it through' do stub_ldap_config( options: { - 'host' => 'ldap.example.com', - 'port' => 686, - 'encryption' => 'simple_tls', + 'host' => 'ldap.example.com', + 'port' => 686, + 'encryption' => 'simple_tls', 'verify_certificates' => true, - 'tls_options' => { - 'ca_file' => '/etc/ca.pem' + 'tls_options' => { + 'ca_file' => '/etc/ca.pem' } } ) @@ -447,12 +447,12 @@ AtlErSqafbECNDSwS5BX8yDpu5yRBJ4xegO/rNlmb8ICRYkuJapD1xXicFOsmfUK it 'does not include the ca_file option' do stub_ldap_config( options: { - 'host' => 'ldap.example.com', - 'port' => 686, - 'encryption' => 'simple_tls', + 'host' => 'ldap.example.com', + 'port' => 686, + 'encryption' => 'simple_tls', 'verify_certificates' => true, - 'tls_options' => { - 'ca_file' => ' ' + 'tls_options' => { + 'ca_file' => ' ' } } ) @@ -465,12 +465,12 @@ AtlErSqafbECNDSwS5BX8yDpu5yRBJ4xegO/rNlmb8ICRYkuJapD1xXicFOsmfUK it 'passes it through' do stub_ldap_config( options: { - 'host' => 'ldap.example.com', - 'port' => 686, - 'encryption' => 'simple_tls', + 'host' => 'ldap.example.com', + 'port' => 686, + 'encryption' => 'simple_tls', 'verify_certificates' => true, - 'tls_options' => { - 'ssl_version' => 'TLSv1_2' + 'tls_options' => { + 'ssl_version' => 'TLSv1_2' } } ) @@ -483,12 +483,12 @@ AtlErSqafbECNDSwS5BX8yDpu5yRBJ4xegO/rNlmb8ICRYkuJapD1xXicFOsmfUK it 'does not include the ssl_version option' do stub_ldap_config( options: { - 'host' => 'ldap.example.com', - 'port' => 686, - 'encryption' => 'simple_tls', + 'host' => 'ldap.example.com', + 'port' => 686, + 'encryption' => 'simple_tls', 'verify_certificates' => true, - 'tls_options' => { - 'ssl_version' => ' ' + 'tls_options' => { + 'ssl_version' => ' ' } } ) @@ -503,7 +503,7 @@ AtlErSqafbECNDSwS5BX8yDpu5yRBJ4xegO/rNlmb8ICRYkuJapD1xXicFOsmfUK it 'is true when password is set' do stub_ldap_config( options: { - 'bind_dn' => 'uid=admin,dc=example,dc=com', + 'bind_dn' => 'uid=admin,dc=example,dc=com', 'password' => 'super_secret' } ) @@ -514,7 +514,7 @@ AtlErSqafbECNDSwS5BX8yDpu5yRBJ4xegO/rNlmb8ICRYkuJapD1xXicFOsmfUK it 'is true when bind_dn is set and password is empty' do stub_ldap_config( options: { - 'bind_dn' => 'uid=admin,dc=example,dc=com', + 'bind_dn' => 'uid=admin,dc=example,dc=com', 'password' => '' } ) @@ -539,15 +539,15 @@ AtlErSqafbECNDSwS5BX8yDpu5yRBJ4xegO/rNlmb8ICRYkuJapD1xXicFOsmfUK options: { 'attributes' => { 'username' => %w(sAMAccountName), - 'email' => %w(userPrincipalName) + 'email' => %w(userPrincipalName) } } ) expect(config.attributes).to include({ 'username' => %w(sAMAccountName), - 'email' => %w(userPrincipalName), - 'name' => 'cn' + 'email' => %w(userPrincipalName), + 'name' => 'cn' }) end end diff --git a/spec/lib/gitlab/auth/ldap/person_spec.rb b/spec/lib/gitlab/auth/ldap/person_spec.rb index 6857b561370..f8268bb1666 100644 --- a/spec/lib/gitlab/auth/ldap/person_spec.rb +++ b/spec/lib/gitlab/auth/ldap/person_spec.rb @@ -10,10 +10,10 @@ RSpec.describe Gitlab::Auth::Ldap::Person do before do stub_ldap_config( options: { - 'uid' => 'uid', + 'uid' => 'uid', 'attributes' => { - 'name' => 'cn', - 'email' => %w(mail email userPrincipalName), + 'name' => 'cn', + 'email' => %w(mail email userPrincipalName), 'username' => username_attribute } } @@ -53,10 +53,10 @@ RSpec.describe Gitlab::Auth::Ldap::Person do it 'returns a compact and unique array' do stub_ldap_config( options: { - 'uid' => nil, + 'uid' => nil, 'attributes' => { - 'name' => 'cn', - 'email' => 'mail', + 'name' => 'cn', + 'email' => 'mail', 'username' => %w(uid mail), 'first_name' => '' } diff --git a/spec/lib/gitlab/auth/o_auth/auth_hash_spec.rb b/spec/lib/gitlab/auth/o_auth/auth_hash_spec.rb index a044094179c..c94f962ee93 100644 --- a/spec/lib/gitlab/auth/o_auth/auth_hash_spec.rb +++ b/spec/lib/gitlab/auth/o_auth/auth_hash_spec.rb @@ -40,12 +40,12 @@ RSpec.describe Gitlab::Auth::OAuth::AuthHash do let(:info_hash) do { - email: email_ascii, + email: email_ascii, first_name: first_name_ascii, - last_name: last_name_ascii, - name: name_ascii, - nickname: nickname_ascii, - uid: uid_ascii, + last_name: last_name_ascii, + name: name_ascii, + nickname: nickname_ascii, + uid: uid_ascii, address: { locality: 'some locality', country: 'some country' diff --git a/spec/lib/gitlab/auth/otp/strategies/forti_token_cloud_spec.rb b/spec/lib/gitlab/auth/otp/strategies/forti_token_cloud_spec.rb index 57ee53a452e..61e17ad2424 100644 --- a/spec/lib/gitlab/auth/otp/strategies/forti_token_cloud_spec.rb +++ b/spec/lib/gitlab/auth/otp/strategies/forti_token_cloud_spec.rb @@ -49,10 +49,10 @@ RSpec.describe Gitlab::Auth::Otp::Strategies::FortiTokenCloud do stub_request(:post, otp_verification_url) .with(body: JSON(otp_verification_request_body), - headers: { - 'Content-Type' => 'application/json', - 'Authorization' => "Bearer #{access_token}" - }) + headers: { + 'Content-Type' => 'application/json', + 'Authorization' => "Bearer #{access_token}" + }) .to_return(status: otp_verification_response_status, body: '', headers: {}) end diff --git a/spec/lib/gitlab/background_migration/backfill_imported_issue_search_data_spec.rb b/spec/lib/gitlab/background_migration/backfill_imported_issue_search_data_spec.rb index e363a5a6b20..8947262ae9e 100644 --- a/spec/lib/gitlab/background_migration/backfill_imported_issue_search_data_spec.rb +++ b/spec/lib/gitlab/background_migration/backfill_imported_issue_search_data_spec.rb @@ -14,10 +14,10 @@ RSpec.describe Gitlab::BackgroundMigration::BackfillImportedIssueSearchData, table(:projects) .create!( namespace_id: namespace.id, - creator_id: user.id, - name: 'projecty', - path: 'path', - project_namespace_id: namespace.id) + creator_id: user.id, + name: 'projecty', + path: 'path', + project_namespace_id: namespace.id) end let!(:issue) do diff --git a/spec/lib/gitlab/background_migration/backfill_integrations_enable_ssl_verification_spec.rb b/spec/lib/gitlab/background_migration/backfill_integrations_enable_ssl_verification_spec.rb index b3825a7c4ea..3c0b7766871 100644 --- a/spec/lib/gitlab/background_migration/backfill_integrations_enable_ssl_verification_spec.rb +++ b/spec/lib/gitlab/background_migration/backfill_integrations_enable_ssl_verification_spec.rb @@ -9,25 +9,35 @@ RSpec.describe Gitlab::BackgroundMigration::BackfillIntegrationsEnableSslVerific before do integrations.create!(id: 1, type_new: 'Integrations::Bamboo') # unaffected integration integrations.create!(id: 2, type_new: 'Integrations::DroneCi') # no properties - integrations.create!(id: 3, type_new: 'Integrations::DroneCi', + integrations.create!( + id: 3, type_new: 'Integrations::DroneCi', properties: {}) # no URL - integrations.create!(id: 4, type_new: 'Integrations::DroneCi', + integrations.create!( + id: 4, type_new: 'Integrations::DroneCi', properties: { 'drone_url' => '' }) # blank URL - integrations.create!(id: 5, type_new: 'Integrations::DroneCi', + integrations.create!( + id: 5, type_new: 'Integrations::DroneCi', properties: { 'drone_url' => 'https://example.com:foo' }) # invalid URL - integrations.create!(id: 6, type_new: 'Integrations::DroneCi', + integrations.create!( + id: 6, type_new: 'Integrations::DroneCi', properties: { 'drone_url' => 'https://example.com' }) # unknown URL - integrations.create!(id: 7, type_new: 'Integrations::DroneCi', + integrations.create!( + id: 7, type_new: 'Integrations::DroneCi', properties: { 'drone_url' => 'http://cloud.drone.io' }) # no HTTPS - integrations.create!(id: 8, type_new: 'Integrations::DroneCi', + integrations.create!( + id: 8, type_new: 'Integrations::DroneCi', properties: { 'drone_url' => 'https://cloud.drone.io' }) # known URL - integrations.create!(id: 9, type_new: 'Integrations::Teamcity', + integrations.create!( + id: 9, type_new: 'Integrations::Teamcity', properties: { 'teamcity_url' => 'https://example.com' }) # unknown URL - integrations.create!(id: 10, type_new: 'Integrations::Teamcity', + integrations.create!( + id: 10, type_new: 'Integrations::Teamcity', properties: { 'teamcity_url' => 'https://foo.bar.teamcity.com' }) # unknown URL - integrations.create!(id: 11, type_new: 'Integrations::Teamcity', + integrations.create!( + id: 11, type_new: 'Integrations::Teamcity', properties: { 'teamcity_url' => 'https://teamcity.com' }) # unknown URL - integrations.create!(id: 12, type_new: 'Integrations::Teamcity', + integrations.create!( + id: 12, type_new: 'Integrations::Teamcity', properties: { 'teamcity_url' => 'https://customer.teamcity.com' }) # known URL end diff --git a/spec/lib/gitlab/background_migration/backfill_snippet_repositories_spec.rb b/spec/lib/gitlab/background_migration/backfill_snippet_repositories_spec.rb index 6f75d3faef3..1c2e0e991d9 100644 --- a/spec/lib/gitlab/background_migration/backfill_snippet_repositories_spec.rb +++ b/spec/lib/gitlab/background_migration/backfill_snippet_repositories_spec.rb @@ -14,23 +14,23 @@ RSpec.describe Gitlab::BackgroundMigration::BackfillSnippetRepositories, :migrat let!(:user) do users.create!(id: 1, - email: 'user@example.com', - projects_limit: 10, - username: 'test', - name: user_name, - state: user_state, - last_activity_on: 1.minute.ago, - user_type: user_type, - confirmed_at: 1.day.ago) + email: 'user@example.com', + projects_limit: 10, + username: 'test', + name: user_name, + state: user_state, + last_activity_on: 1.minute.ago, + user_type: user_type, + confirmed_at: 1.day.ago) end let!(:migration_bot) do users.create!(id: 100, - email: "noreply+gitlab-migration-bot%s@#{Settings.gitlab.host}", - user_type: HasUserType::USER_TYPES[:migration_bot], - name: 'GitLab Migration Bot', - projects_limit: 10, - username: 'bot') + email: "noreply+gitlab-migration-bot%s@#{Settings.gitlab.host}", + user_type: HasUserType::USER_TYPES[:migration_bot], + name: 'GitLab Migration Bot', + projects_limit: 10, + username: 'bot') end let!(:snippet_with_repo) { snippets.create!(id: 1, type: 'PersonalSnippet', author_id: user.id, file_name: file_name, content: content) } @@ -260,14 +260,14 @@ RSpec.describe Gitlab::BackgroundMigration::BackfillSnippetRepositories, :migrat let(:user_name) { '.' } let!(:other_user) do users.create!(id: 2, - email: 'user2@example.com', - projects_limit: 10, - username: 'test2', - name: 'Test2', - state: user_state, - last_activity_on: 1.minute.ago, - user_type: user_type, - confirmed_at: 1.day.ago) + email: 'user2@example.com', + projects_limit: 10, + username: 'test2', + name: 'Test2', + state: user_state, + last_activity_on: 1.minute.ago, + user_type: user_type, + confirmed_at: 1.day.ago) end let!(:invalid_snippet) { snippets.create!(id: 4, type: 'PersonalSnippet', author_id: user.id, file_name: '.', content: content) } diff --git a/spec/lib/gitlab/background_migration/encrypt_integration_properties_spec.rb b/spec/lib/gitlab/background_migration/encrypt_integration_properties_spec.rb index 38e8b159e63..c788b701d79 100644 --- a/spec/lib/gitlab/background_migration/encrypt_integration_properties_spec.rb +++ b/spec/lib/gitlab/background_migration/encrypt_integration_properties_spec.rb @@ -40,10 +40,10 @@ RSpec.describe Gitlab::BackgroundMigration::EncryptIntegrationProperties, schema expect(integrations.count).to eq(4) expect(props).to match( - no_properties.id => both(be_nil), + no_properties.id => both(be_nil), with_plaintext_1.id => both(eq some_props(1)), with_plaintext_2.id => both(eq some_props(2)), - with_encrypted.id => match([be_nil, eq(some_props(3))]) + with_encrypted.id => match([be_nil, eq(some_props(3))]) ) end diff --git a/spec/lib/gitlab/ci/config/entry/port_spec.rb b/spec/lib/gitlab/ci/config/entry/port_spec.rb index e2840c07f6b..77f846f95f0 100644 --- a/spec/lib/gitlab/ci/config/entry/port_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/port_spec.rb @@ -48,7 +48,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Port do let(:config) do { number: 80, protocol: 'http', - name: 'foobar' } + name: 'foobar' } end describe '#valid?' do diff --git a/spec/lib/gitlab/ci/config/entry/root_spec.rb b/spec/lib/gitlab/ci/config/entry/root_spec.rb index 5efc65f2117..19a4c82dcc1 100644 --- a/spec/lib/gitlab/ci/config/entry/root_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/root_spec.rb @@ -117,49 +117,49 @@ RSpec.describe Gitlab::Ci::Config::Entry::Root do expect(root.jobs_value.keys).to eq([:rspec, :spinach, :release]) expect(root.jobs_value[:rspec]).to eq( { name: :rspec, - script: %w[rspec ls], - before_script: %w(ls pwd), - image: { name: 'image:1.0' }, - services: [{ name: 'postgres:9.1' }, { name: 'mysql:5.5' }], - stage: 'test', - cache: [{ key: 'k', untracked: true, paths: ['public/'], policy: 'pull-push', when: 'on_success' }], - job_variables: {}, - root_variables_inheritance: true, - ignore: false, - after_script: ['make clean'], - only: { refs: %w[branches tags] }, - scheduling_type: :stage } + script: %w[rspec ls], + before_script: %w(ls pwd), + image: { name: 'image:1.0' }, + services: [{ name: 'postgres:9.1' }, { name: 'mysql:5.5' }], + stage: 'test', + cache: [{ key: 'k', untracked: true, paths: ['public/'], policy: 'pull-push', when: 'on_success' }], + job_variables: {}, + root_variables_inheritance: true, + ignore: false, + after_script: ['make clean'], + only: { refs: %w[branches tags] }, + scheduling_type: :stage } ) expect(root.jobs_value[:spinach]).to eq( { name: :spinach, - before_script: [], - script: %w[spinach], - image: { name: 'image:1.0' }, - services: [{ name: 'postgres:9.1' }, { name: 'mysql:5.5' }], - stage: 'test', - cache: [{ key: 'k', untracked: true, paths: ['public/'], policy: 'pull-push', when: 'on_success' }], - job_variables: {}, - root_variables_inheritance: true, - ignore: false, - after_script: ['make clean'], - only: { refs: %w[branches tags] }, - scheduling_type: :stage } + before_script: [], + script: %w[spinach], + image: { name: 'image:1.0' }, + services: [{ name: 'postgres:9.1' }, { name: 'mysql:5.5' }], + stage: 'test', + cache: [{ key: 'k', untracked: true, paths: ['public/'], policy: 'pull-push', when: 'on_success' }], + job_variables: {}, + root_variables_inheritance: true, + ignore: false, + after_script: ['make clean'], + only: { refs: %w[branches tags] }, + scheduling_type: :stage } ) expect(root.jobs_value[:release]).to eq( { name: :release, - stage: 'release', - before_script: [], - script: ["make changelog | tee release_changelog.txt"], - release: { name: "Release $CI_TAG_NAME", tag_name: 'v0.06', description: "./release_changelog.txt" }, - image: { name: "image:1.0" }, - services: [{ name: "postgres:9.1" }, { name: "mysql:5.5" }], - cache: [{ key: "k", untracked: true, paths: ["public/"], policy: "pull-push", when: 'on_success' }], - only: { refs: %w(branches tags) }, - job_variables: { 'VAR' => 'job' }, - root_variables_inheritance: true, - after_script: [], - ignore: false, - scheduling_type: :stage } + stage: 'release', + before_script: [], + script: ["make changelog | tee release_changelog.txt"], + release: { name: "Release $CI_TAG_NAME", tag_name: 'v0.06', description: "./release_changelog.txt" }, + image: { name: "image:1.0" }, + services: [{ name: "postgres:9.1" }, { name: "mysql:5.5" }], + cache: [{ key: "k", untracked: true, paths: ["public/"], policy: "pull-push", when: 'on_success' }], + only: { refs: %w(branches tags) }, + job_variables: { 'VAR' => 'job' }, + root_variables_inheritance: true, + after_script: [], + ignore: false, + scheduling_type: :stage } ) end end @@ -196,31 +196,31 @@ RSpec.describe Gitlab::Ci::Config::Entry::Root do it 'returns jobs configuration' do expect(root.jobs_value).to eq( rspec: { name: :rspec, - script: %w[rspec ls], - before_script: %w(ls pwd), - image: { name: 'image:1.0' }, - services: [{ name: 'postgres:9.1' }, { name: 'mysql:5.5' }], - stage: 'test', - cache: [{ key: 'k', untracked: true, paths: ['public/'], policy: 'pull-push', when: 'on_success' }], - job_variables: {}, - root_variables_inheritance: true, - ignore: false, - after_script: ['make clean'], - only: { refs: %w[branches tags] }, - scheduling_type: :stage }, + script: %w[rspec ls], + before_script: %w(ls pwd), + image: { name: 'image:1.0' }, + services: [{ name: 'postgres:9.1' }, { name: 'mysql:5.5' }], + stage: 'test', + cache: [{ key: 'k', untracked: true, paths: ['public/'], policy: 'pull-push', when: 'on_success' }], + job_variables: {}, + root_variables_inheritance: true, + ignore: false, + after_script: ['make clean'], + only: { refs: %w[branches tags] }, + scheduling_type: :stage }, spinach: { name: :spinach, - before_script: [], - script: %w[spinach], - image: { name: 'image:1.0' }, - services: [{ name: 'postgres:9.1' }, { name: 'mysql:5.5' }], - stage: 'test', - cache: [{ key: 'k', untracked: true, paths: ['public/'], policy: 'pull-push', when: 'on_success' }], - job_variables: { 'VAR' => 'job' }, - root_variables_inheritance: true, - ignore: false, - after_script: ['make clean'], - only: { refs: %w[branches tags] }, - scheduling_type: :stage } + before_script: [], + script: %w[spinach], + image: { name: 'image:1.0' }, + services: [{ name: 'postgres:9.1' }, { name: 'mysql:5.5' }], + stage: 'test', + cache: [{ key: 'k', untracked: true, paths: ['public/'], policy: 'pull-push', when: 'on_success' }], + job_variables: { 'VAR' => 'job' }, + root_variables_inheritance: true, + ignore: false, + after_script: ['make clean'], + only: { refs: %w[branches tags] }, + scheduling_type: :stage } ) end end |