diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-29 18:07:48 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-29 18:07:48 +0300 |
commit | cbafce7e89a8761c0c8062392803346f42f489fc (patch) | |
tree | b62b9c6562e5717787cfa7d3065825d009cab133 /spec | |
parent | e5f2a04e9d54615fded2ca05d0d5eef464795a8f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r-- | spec/fast_spec_helper.rb | 6 | ||||
-rw-r--r-- | spec/features/admin/admin_settings_spec.rb | 2 | ||||
-rw-r--r-- | spec/features/projects/clusters/gcp_spec.rb | 2 | ||||
-rw-r--r-- | spec/frontend/projects/settings/components/shared_runners_toggle_spec.js | 40 | ||||
-rw-r--r-- | spec/helpers/ci/runners_helper_spec.rb | 16 | ||||
-rw-r--r-- | spec/models/user_spec.rb | 8 | ||||
-rw-r--r-- | spec/spec_helper.rb | 5 |
7 files changed, 67 insertions, 12 deletions
diff --git a/spec/fast_spec_helper.rb b/spec/fast_spec_helper.rb index 469c29cd2e0..0672a47c73c 100644 --- a/spec/fast_spec_helper.rb +++ b/spec/fast_spec_helper.rb @@ -24,6 +24,8 @@ ActiveSupport::Dependencies.autoload_paths << 'ee/lib' ActiveSupport::XmlMini.backend = 'Nokogiri' RSpec.configure do |config| - config.filter_run focus: true - config.run_all_when_everything_filtered = true + unless ENV['CI'] + config.filter_run focus: true + config.run_all_when_everything_filtered = true + end end diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb index ef4877b390e..5a4c47b9dc5 100644 --- a/spec/features/admin/admin_settings_spec.rb +++ b/spec/features/admin/admin_settings_spec.rb @@ -275,7 +275,7 @@ RSpec.describe 'Admin updates settings' do it 'enable hiding third party offers' do page.within('.as-third-party-offers') do - check 'Do not display offers from third parties within GitLab' + check 'Do not display offers from third parties' click_button 'Save changes' end diff --git a/spec/features/projects/clusters/gcp_spec.rb b/spec/features/projects/clusters/gcp_spec.rb index 8c497cded8e..21e587288f5 100644 --- a/spec/features/projects/clusters/gcp_spec.rb +++ b/spec/features/projects/clusters/gcp_spec.rb @@ -214,7 +214,7 @@ RSpec.describe 'Gcp Cluster', :js do it 'user does not see the offer' do page.within('.as-third-party-offers') do click_button 'Expand' - check 'Do not display offers from third parties within GitLab' + check 'Do not display offers from third parties' click_button 'Save changes' end diff --git a/spec/frontend/projects/settings/components/shared_runners_toggle_spec.js b/spec/frontend/projects/settings/components/shared_runners_toggle_spec.js index 2d6efe7ae83..b592db8a64e 100644 --- a/spec/frontend/projects/settings/components/shared_runners_toggle_spec.js +++ b/spec/frontend/projects/settings/components/shared_runners_toggle_spec.js @@ -1,6 +1,8 @@ import { GlAlert, GlToggle, GlTooltip } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; import MockAxiosAdapter from 'axios-mock-adapter'; +import CcValidationRequiredAlert from 'ee_component/billings/components/cc_validation_required_alert.vue'; +import { TEST_HOST } from 'helpers/test_constants'; import waitForPromises from 'helpers/wait_for_promises'; import axios from '~/lib/utils/axios_utils'; import SharedRunnersToggleComponent from '~/projects/settings/components/shared_runners_toggle.vue'; @@ -20,6 +22,7 @@ describe('projects/settings/components/shared_runners', () => { isDisabledAndUnoverridable: false, isLoading: false, updatePath: TEST_UPDATE_PATH, + isCreditCardValidationRequired: false, ...props, }, }); @@ -28,6 +31,7 @@ describe('projects/settings/components/shared_runners', () => { const findErrorAlert = () => wrapper.find(GlAlert); const findSharedRunnersToggle = () => wrapper.find(GlToggle); const findToggleTooltip = () => wrapper.find(GlTooltip); + const findCcValidationRequiredAlert = () => wrapper.findComponent(CcValidationRequiredAlert); const getToggleValue = () => findSharedRunnersToggle().props('value'); const isToggleLoading = () => findSharedRunnersToggle().props('isLoading'); const isToggleDisabled = () => findSharedRunnersToggle().props('disabled'); @@ -154,4 +158,40 @@ describe('projects/settings/components/shared_runners', () => { }); }); }); + + describe('with credit card validation required and shared runners DISABLED', () => { + beforeEach(() => { + window.gon = { + subscriptions_url: TEST_HOST, + payment_form_url: TEST_HOST, + }; + + createComponent({ + isCreditCardValidationRequired: true, + isEnabled: false, + }); + }); + + it('toggle should not be visible', () => { + expect(findSharedRunnersToggle().exists()).toBe(false); + }); + + it('credit card validation component should exist', () => { + expect(findCcValidationRequiredAlert().exists()).toBe(true); + expect(findCcValidationRequiredAlert().text()).toBe( + SharedRunnersToggleComponent.i18n.REQUIRES_VALIDATION_TEXT, + ); + }); + + describe('when credit card is validated', () => { + it('should show the toggle button', async () => { + findCcValidationRequiredAlert().vm.$emit('verifiedCreditCard'); + await waitForPromises(); + + expect(findSharedRunnersToggle().exists()).toBe(true); + expect(getToggleValue()).toBe(false); + expect(isToggleDisabled()).toBe(false); + }); + }); + }); }); diff --git a/spec/helpers/ci/runners_helper_spec.rb b/spec/helpers/ci/runners_helper_spec.rb index 94d4d620de9..40927d44e24 100644 --- a/spec/helpers/ci/runners_helper_spec.rb +++ b/spec/helpers/ci/runners_helper_spec.rb @@ -3,6 +3,12 @@ require 'spec_helper' RSpec.describe Ci::RunnersHelper do + let_it_be(:user, refind: true) { create(:user) } + + before do + allow(helper).to receive(:current_user).and_return(user) + end + describe '#runner_status_icon', :clean_gitlab_redis_cache do it "returns - not contacted yet" do runner = create(:ci_runner) @@ -90,28 +96,28 @@ RSpec.describe Ci::RunnersHelper do context 'when project has runners' do it 'returns the correct value for is_enabled' do - data = toggle_shared_runners_settings_data(project_with_runners) + data = helper.toggle_shared_runners_settings_data(project_with_runners) expect(data[:is_enabled]).to eq("true") end end context 'when project does not have runners' do it 'returns the correct value for is_enabled' do - data = toggle_shared_runners_settings_data(project_without_runners) + data = helper.toggle_shared_runners_settings_data(project_without_runners) expect(data[:is_enabled]).to eq("false") end end context 'for all projects' do it 'returns the update path for toggling the shared runners setting' do - data = toggle_shared_runners_settings_data(project_with_runners) + data = helper.toggle_shared_runners_settings_data(project_with_runners) expect(data[:update_path]).to eq(toggle_shared_runners_project_runners_path(project_with_runners)) end it 'returns false for is_disabled_and_unoverridable when project has no group' do project = create(:project) - data = toggle_shared_runners_settings_data(project) + data = helper.toggle_shared_runners_settings_data(project) expect(data[:is_disabled_and_unoverridable]).to eq("false") end @@ -129,7 +135,7 @@ RSpec.describe Ci::RunnersHelper do project = create(:project, group: group) allow(group).to receive(:shared_runners_setting).and_return(shared_runners_setting) - data = toggle_shared_runners_settings_data(project) + data = helper.toggle_shared_runners_settings_data(project) expect(data[:is_disabled_and_unoverridable]).to eq(is_disabled_and_unoverridable) end end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 63df2409e8e..58632a4ebe8 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -2813,6 +2813,14 @@ RSpec.describe User do end end + describe '#matches_identity?' do + it 'finds the identity when the DN is formatted differently' do + user = create(:omniauth_user, provider: 'ldapmain', extern_uid: 'uid=john smith,ou=people,dc=example,dc=com') + + expect(user.matches_identity?('ldapmain', 'uid=John Smith, ou=People, dc=example, dc=com')).to eq(true) + end + end + describe '#ldap_block' do let(:user) { create(:omniauth_user, provider: 'ldapmain', name: 'John Smith') } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e94ff5bcb45..6a2975e566a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -76,9 +76,6 @@ require_relative '../tooling/quality/test_level' quality_level = Quality::TestLevel.new RSpec.configure do |config| - config.filter_run focus: true - config.run_all_when_everything_filtered = true - config.use_transactional_fixtures = true config.use_instantiated_fixtures = false config.fixture_path = Rails.root @@ -113,6 +110,8 @@ RSpec.configure do |config| end unless ENV['CI'] + config.filter_run focus: true + config.run_all_when_everything_filtered = true # Re-run failures locally with `--only-failures` config.example_status_persistence_file_path = './spec/examples.txt' end |