diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-14 03:07:29 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-14 03:07:29 +0000 |
commit | 1103945ed4f3e430b8029b4a7893e214dfe289fb (patch) | |
tree | 5bd67830842c9d8f964a09f3a601581efdb0c358 /spec | |
parent | dbfcd56fcbb4e148920094ab004ed175468911c3 (diff) | |
download | gitlab-ce-1103945ed4f3e430b8029b4a7893e214dfe289fb.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/projects_spec.rb | 2 | ||||
-rw-r--r-- | spec/frontend/vue_merge_request_widget/extentions/code_quality/index_spec.js | 12 | ||||
-rw-r--r-- | spec/support/database/query_recorder.rb | 8 | ||||
-rw-r--r-- | spec/tooling/danger/user_types_spec.rb | 56 |
4 files changed, 76 insertions, 2 deletions
diff --git a/spec/features/projects_spec.rb b/spec/features/projects_spec.rb index 047e4dcf5dc..701dcebb0f3 100644 --- a/spec/features/projects_spec.rb +++ b/spec/features/projects_spec.rb @@ -329,7 +329,7 @@ RSpec.describe 'Project', feature_category: :projects do it 'has working links to submodules' do click_link('645f6c4c') - expect(page).to have_selector('[data-testid="branches-select"]', text: '645f6c4c82fd3f5e06f67134450a570b795e55a6') + expect(page).to have_selector('.ref-selector', text: '645f6c4c82fd3f5e06f67134450a570b795e55a6') end context 'for signed commit on default branch', :js do diff --git a/spec/frontend/vue_merge_request_widget/extentions/code_quality/index_spec.js b/spec/frontend/vue_merge_request_widget/extentions/code_quality/index_spec.js index 9a72e4a086b..097cab4db06 100644 --- a/spec/frontend/vue_merge_request_widget/extentions/code_quality/index_spec.js +++ b/spec/frontend/vue_merge_request_widget/extentions/code_quality/index_spec.js @@ -1,4 +1,5 @@ import MockAdapter from 'axios-mock-adapter'; +import { GlBadge } from '@gitlab/ui'; import { mountExtended } from 'helpers/vue_test_utils_helper'; import { trimText } from 'helpers/text_helper'; import waitForPromises from 'helpers/wait_for_promises'; @@ -138,8 +139,17 @@ describe('Code Quality extension', () => { "Minor - Parsing error: 'return' outside of function in index.js:12", ); expect(text.resolvedError).toContain( - "Minor - Parsing error: 'return' outside of function in index.js:12", + "Minor - Parsing error: 'return' outside of function Fixed in index.js:12", ); }); + + it('adds fixed indicator (badge) when error is resolved', () => { + expect(findAllExtensionListItems().at(1).findComponent(GlBadge).exists()).toBe(true); + expect(findAllExtensionListItems().at(1).findComponent(GlBadge).text()).toEqual('Fixed'); + }); + + it('should not add fixed indicator (badge) when error is new', () => { + expect(findAllExtensionListItems().at(0).findComponent(GlBadge).exists()).toBe(false); + }); }); }); diff --git a/spec/support/database/query_recorder.rb b/spec/support/database/query_recorder.rb index 3480430a0da..c0736221af3 100644 --- a/spec/support/database/query_recorder.rb +++ b/spec/support/database/query_recorder.rb @@ -5,5 +5,13 @@ RSpec.configure do |config| config.before(:suite) do log_file = Rails.root.join(Gitlab::Database::QueryAnalyzers::QueryRecorder.log_file) File.write(log_file, '') if File.exist?(log_file) + File.delete("#{log_file}.gz") if File.exist?("#{log_file}.gz") + end + + config.after(:suite) do + if ENV['CI'] + log_file = Rails.root.join(Gitlab::Database::QueryAnalyzers::QueryRecorder.log_file) + system("gzip #{log_file}") if File.exist?(log_file) + end end end diff --git a/spec/tooling/danger/user_types_spec.rb b/spec/tooling/danger/user_types_spec.rb new file mode 100644 index 00000000000..4b87f649760 --- /dev/null +++ b/spec/tooling/danger/user_types_spec.rb @@ -0,0 +1,56 @@ +# frozen_string_literal: true + +require 'gitlab-dangerfiles' +require 'gitlab/dangerfiles/spec_helper' +require_relative '../../../tooling/danger/user_types' + +RSpec.describe Tooling::Danger::UserTypes, feature_category: :subscription_usage_reports do + include_context 'with dangerfile' + + let(:fake_danger) { DangerSpecHelper.fake_danger.include(described_class) } + let(:user_types) { fake_danger.new(helper: fake_helper) } + + describe 'changed files' do + subject(:bot_user_types_change_warning) { user_types.bot_user_types_change_warning } + + before do + allow(fake_helper).to receive(:modified_files).and_return(modified_files) + allow(fake_helper).to receive(:changed_lines).and_return(changed_lines) + end + + context 'when has_user_type.rb file is not impacted' do + let(:modified_files) { ['app/models/concerns/importable.rb'] } + let(:changed_lines) { ['+ANY_CHANGES'] } + + it "doesn't add any warnings" do + expect(user_types).not_to receive(:warn) + + bot_user_types_change_warning + end + end + + context 'when the has_user_type.rb file is impacted' do + let(:modified_files) { ['app/models/concerns/has_user_type.rb'] } + + context 'with BOT_USER_TYPES changes' do + let(:changed_lines) { ['+BOT_USER_TYPES'] } + + it 'adds warning' do + expect(user_types).to receive(:warn).with(described_class::BOT_USER_TYPES_CHANGED_WARNING) + + bot_user_types_change_warning + end + end + + context 'without BOT_USER_TYPES changes' do + let(:changed_lines) { ['+OTHER_CHANGES'] } + + it "doesn't add any warnings" do + expect(user_types).not_to receive(:warn) + + bot_user_types_change_warning + end + end + end + end +end |