diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-17 09:10:33 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-17 09:10:33 +0300 |
commit | 7118851f0272b099335a34d8ca18a045aa5de51d (patch) | |
tree | 4ef50130a82a7b544936b9a298eb2c0e4968ec2e /spec | |
parent | b24742b7ed7add26a843d31207113610774fed4c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/expand_collapse_diffs_spec.rb | 5 | ||||
-rw-r--r-- | spec/frontend/boards/components/board_filtered_search_spec.js | 8 | ||||
-rw-r--r-- | spec/models/integrations/harbor_spec.rb | 70 | ||||
-rw-r--r-- | spec/scripts/lib/glfm/update_specification_spec.rb | 33 |
4 files changed, 42 insertions, 74 deletions
diff --git a/spec/features/expand_collapse_diffs_spec.rb b/spec/features/expand_collapse_diffs_spec.rb index 98282e47488..c3096677a73 100644 --- a/spec/features/expand_collapse_diffs_spec.rb +++ b/spec/features/expand_collapse_diffs_spec.rb @@ -4,12 +4,13 @@ require 'spec_helper' RSpec.describe 'Expand and collapse diffs', :js do let(:branch) { 'expand-collapse-diffs' } - let(:project) { create(:project, :repository) } + + let_it_be(:project) { create(:project, :repository) } + let_it_be(:admin) { create(:admin) } before do allow(Gitlab::CurrentSettings).to receive(:diff_max_patch_bytes).and_return(100.kilobytes) - admin = create(:admin) sign_in(admin) gitlab_enable_admin_mode_sign_in(admin) diff --git a/spec/frontend/boards/components/board_filtered_search_spec.js b/spec/frontend/boards/components/board_filtered_search_spec.js index 731578e15a3..1a07b9f0b78 100644 --- a/spec/frontend/boards/components/board_filtered_search_spec.js +++ b/spec/frontend/boards/components/board_filtered_search_spec.js @@ -126,6 +126,7 @@ describe('BoardFilteredSearch', () => { { type: 'weight', value: { data: '2', operator: '=' } }, { type: 'iteration', value: { data: 'Any&3', operator: '=' } }, { type: 'release', value: { data: 'v1.0.0', operator: '=' } }, + { type: 'health_status', value: { data: 'onTrack', operator: '=' } }, ]; jest.spyOn(urlUtility, 'updateHistory'); findFilteredSearch().vm.$emit('onFilter', mockFilters); @@ -134,7 +135,7 @@ describe('BoardFilteredSearch', () => { title: '', replace: true, url: - 'http://test.host/?author_username=root&label_name[]=label&label_name[]=label%262&assignee_username=root&milestone_title=New%20Milestone&iteration_id=Any&iteration_cadence_id=3&types=INCIDENT&weight=2&release_tag=v1.0.0', + 'http://test.host/?author_username=root&label_name[]=label&label_name[]=label%262&assignee_username=root&milestone_title=New%20Milestone&iteration_id=Any&iteration_cadence_id=3&types=INCIDENT&weight=2&release_tag=v1.0.0&health_status=onTrack', }); }); @@ -160,7 +161,9 @@ describe('BoardFilteredSearch', () => { describe('when url params are already set', () => { beforeEach(() => { - createComponent({ initialFilterParams: { authorUsername: 'root', labelName: ['label'] } }); + createComponent({ + initialFilterParams: { authorUsername: 'root', labelName: ['label'], healthStatus: 'Any' }, + }); jest.spyOn(store, 'dispatch'); }); @@ -169,6 +172,7 @@ describe('BoardFilteredSearch', () => { expect(findFilteredSearch().props('initialFilterValue')).toEqual([ { type: 'author', value: { data: 'root', operator: '=' } }, { type: 'label', value: { data: 'label', operator: '=' } }, + { type: 'health_status', value: { data: 'Any', operator: '=' } }, ]); }); }); diff --git a/spec/models/integrations/harbor_spec.rb b/spec/models/integrations/harbor_spec.rb index 26b43fa3313..9ab37a92e89 100644 --- a/spec/models/integrations/harbor_spec.rb +++ b/spec/models/integrations/harbor_spec.rb @@ -7,7 +7,11 @@ RSpec.describe Integrations::Harbor do let(:project_name) { 'testproject' } let(:username) { 'harborusername' } let(:password) { 'harborpassword' } - let(:harbor_integration) { create(:harbor_integration) } + let(:harbor_integration) { build(:harbor_integration) } + + it_behaves_like Integrations::ResetSecretFields do + let(:integration) { described_class.new } + end describe "masked password" do subject { build(:harbor_integration) } @@ -66,6 +70,8 @@ RSpec.describe Integrations::Harbor do end context 'ci variables' do + let(:harbor_integration) { create(:harbor_integration) } + it 'returns vars when harbor_integration is activated' do ci_vars = [ { key: 'HARBOR_URL', value: url }, @@ -94,66 +100,4 @@ RSpec.describe Integrations::Harbor do end end end - - describe 'before_validation :reset_username_and_password' do - context 'when username/password was previously set' do - it 'resets username and password if url changed' do - harbor_integration.url = 'https://anotherharbor.com' - harbor_integration.valid? - - expect(harbor_integration.password).to be_nil - expect(harbor_integration.username).to be_nil - end - - it 'does not reset password if username changed' do - harbor_integration.username = 'newusername' - harbor_integration.valid? - - expect(harbor_integration.password).to eq('harborpassword') - end - - it 'does not reset username if password changed' do - harbor_integration.password = 'newpassword' - harbor_integration.valid? - - expect(harbor_integration.username).to eq('harborusername') - end - - it "does not reset password if new url is set together with password, even if it's the same password" do - harbor_integration.url = 'https://anotherharbor.com' - harbor_integration.password = 'harborpassword' - harbor_integration.valid? - - expect(harbor_integration.password).to eq('harborpassword') - expect(harbor_integration.username).to be_nil - expect(harbor_integration.url).to eq('https://anotherharbor.com') - end - - it "does not reset username if new url is set together with username, even if it's the same username" do - harbor_integration.url = 'https://anotherharbor.com' - harbor_integration.username = 'harborusername' - harbor_integration.valid? - - expect(harbor_integration.password).to be_nil - expect(harbor_integration.username).to eq('harborusername') - expect(harbor_integration.url).to eq('https://anotherharbor.com') - end - end - - it 'saves password if new url is set together with password when no password was previously set' do - harbor_integration.password = nil - harbor_integration.username = nil - - harbor_integration.url = 'https://anotherharbor.com' - harbor_integration.password = 'newpassword' - harbor_integration.username = 'newusername' - harbor_integration.save! - - expect(harbor_integration).to have_attributes( - url: 'https://anotherharbor.com', - password: 'newpassword', - username: 'newusername' - ) - end - end end diff --git a/spec/scripts/lib/glfm/update_specification_spec.rb b/spec/scripts/lib/glfm/update_specification_spec.rb index 7daf85b5d25..d13cc3f19eb 100644 --- a/spec/scripts/lib/glfm/update_specification_spec.rb +++ b/spec/scripts/lib/glfm/update_specification_spec.rb @@ -16,8 +16,10 @@ RSpec.describe Glfm::UpdateSpecification, '#process' do let(:glfm_intro_md_path) { described_class::GLFM_INTRO_MD_PATH } let(:glfm_intro_md_io) { StringIO.new(glfm_intro_md_contents) } - let(:glfm_examples_txt_path) { described_class::GLFM_EXAMPLES_TXT_PATH } - let(:glfm_examples_txt_io) { StringIO.new(glfm_examples_txt_contents) } + let(:glfm_official_specification_examples_md_path) { described_class::GLFM_OFFICIAL_SPECIFICATION_EXAMPLES_MD_PATH } + let(:glfm_official_specification_examples_md_io) { StringIO.new(glfm_official_specification_examples_md_contents) } + let(:glfm_internal_extension_examples_md_path) { described_class::GLFM_INTERNAL_EXTENSION_EXAMPLES_MD_PATH } + let(:glfm_internal_extension_examples_md_io) { StringIO.new(glfm_internal_extension_examples_md_contents) } let(:glfm_spec_txt_path) { described_class::GLFM_SPEC_TXT_PATH } let(:glfm_spec_txt_io) { StringIO.new } @@ -67,9 +69,17 @@ RSpec.describe Glfm::UpdateSpecification, '#process' do MARKDOWN end - let(:glfm_examples_txt_contents) do + let(:glfm_official_specification_examples_md_contents) do <<~MARKDOWN - # GitLab-Specific Section with Examples + # Official Specification Section with Examples + + Some examples. + MARKDOWN + end + + let(:glfm_internal_extension_examples_md_contents) do + <<~MARKDOWN + # Internal Extension Section with Examples Some examples. MARKDOWN @@ -88,7 +98,12 @@ RSpec.describe Glfm::UpdateSpecification, '#process' do end allow(File).to receive(:open).with(ghfm_spec_md_path) { ghfm_spec_txt_local_io } allow(File).to receive(:open).with(glfm_intro_md_path) { glfm_intro_md_io } - allow(File).to receive(:open).with(glfm_examples_txt_path) { glfm_examples_txt_io } + allow(File).to receive(:open).with(glfm_official_specification_examples_md_path) do + glfm_official_specification_examples_md_io + end + allow(File).to receive(:open).with(glfm_internal_extension_examples_md_path) do + glfm_internal_extension_examples_md_io + end allow(File).to receive(:open).with(glfm_spec_txt_path, 'w') { glfm_spec_txt_io } # Prevent console output when running tests @@ -179,11 +194,15 @@ RSpec.describe Glfm::UpdateSpecification, '#process' do expect(glfm_contents).to match(/#{Regexp.escape(glfm_intro_md_contents)}/m) end - it 'inserts the GitLab examples sections before the appendix section' do + it 'inserts the GitLab official spec and internal extension examples sections before the appendix section' do expected = <<~MARKDOWN End of last GitHub examples section. - # GitLab-Specific Section with Examples + # Official Specification Section with Examples + + Some examples. + + # Internal Extension Section with Examples Some examples. |