Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-05-20 21:07:48 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-05-20 21:07:48 +0300
commite32f083f49a50ee2f7c217eb0d51d759958145f3 (patch)
tree0624191ff758f73b7a19ff30daf539e6210b6cc0 /spec
parent6997e3f3d0a714bc67df268989fb089c943330cc (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r--spec/features/nav/top_nav_tooltip_spec.rb24
-rw-r--r--spec/frontend/diffs/components/diff_line_note_form_spec.js10
-rw-r--r--spec/graphql/mutations/ci/runner/update_spec.rb11
-rw-r--r--spec/lib/gitlab/database_spec.rb13
4 files changed, 54 insertions, 4 deletions
diff --git a/spec/features/nav/top_nav_tooltip_spec.rb b/spec/features/nav/top_nav_tooltip_spec.rb
new file mode 100644
index 00000000000..7c34fb01ca9
--- /dev/null
+++ b/spec/features/nav/top_nav_tooltip_spec.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'top nav tooltips', :js do
+ let_it_be(:user) { create(:user) }
+
+ before do
+ sign_in(user)
+ visit explore_projects_path
+ end
+
+ it 'clicking new dropdown hides tooltip', :aggregate_failures do
+ btn = '#js-onboarding-new-project-link'
+
+ page.find(btn).hover
+
+ expect(page).to have_content('New...')
+
+ page.find(btn).click
+
+ expect(page).not_to have_content('New...')
+ end
+end
diff --git a/spec/frontend/diffs/components/diff_line_note_form_spec.js b/spec/frontend/diffs/components/diff_line_note_form_spec.js
index fb9dc22ce25..b59043168b8 100644
--- a/spec/frontend/diffs/components/diff_line_note_form_spec.js
+++ b/spec/frontend/diffs/components/diff_line_note_form_spec.js
@@ -64,6 +64,16 @@ describe('DiffLineNoteForm', () => {
expect(confirmAction).toHaveBeenCalled();
});
+ it('should only ask for confirmation once', () => {
+ // Never resolve so we can test what happens when triggered while "confirmAction" is loading
+ confirmAction.mockImplementation(() => new Promise(() => {}));
+
+ findNoteForm().vm.$emit('cancelForm', true, true);
+ findNoteForm().vm.$emit('cancelForm', true, true);
+
+ expect(confirmAction).toHaveBeenCalledTimes(1);
+ });
+
it('should not ask for confirmation when one of the params false', () => {
confirmAction.mockResolvedValueOnce(false);
diff --git a/spec/graphql/mutations/ci/runner/update_spec.rb b/spec/graphql/mutations/ci/runner/update_spec.rb
index 75e9b57e60a..b8efd4213fa 100644
--- a/spec/graphql/mutations/ci/runner/update_spec.rb
+++ b/spec/graphql/mutations/ci/runner/update_spec.rb
@@ -49,6 +49,7 @@ RSpec.describe Mutations::Ci::Runner::Update do
{
id: runner.to_global_id,
description: 'updated description',
+ maintenance_note: 'updated maintenance note',
maximum_timeout: 900,
access_level: 'ref_protected',
active: false,
@@ -84,6 +85,16 @@ RSpec.describe Mutations::Ci::Runner::Update do
)
end
end
+
+ context 'with too long maintenance note' do
+ it 'returns a descriptive error' do
+ mutation_params[:maintenance_note] = '1' * 1025
+
+ expect(subject[:errors]).to contain_exactly(
+ 'Maintenance note is too long (maximum is 1024 characters)'
+ )
+ end
+ end
end
end
end
diff --git a/spec/lib/gitlab/database_spec.rb b/spec/lib/gitlab/database_spec.rb
index 23f4f0e7089..025cf05424e 100644
--- a/spec/lib/gitlab/database_spec.rb
+++ b/spec/lib/gitlab/database_spec.rb
@@ -222,10 +222,6 @@ RSpec.describe Gitlab::Database do
end
describe '.gitlab_schemas_for_connection' do
- it 'does raise exception for invalid connection' do
- expect { described_class.gitlab_schemas_for_connection(:invalid) }.to raise_error /key not found: "unknown"/
- end
-
it 'does return a valid schema depending on a base model used', :request_store do
# FF due to lib/gitlab/database/load_balancing/configuration.rb:92
stub_feature_flags(force_no_sharing_primary_model: true)
@@ -282,6 +278,15 @@ RSpec.describe Gitlab::Database do
end
end
end
+
+ it 'does return empty for non-adopted connections' do
+ new_connection = ActiveRecord::Base.postgresql_connection(
+ ActiveRecord::Base.connection_db_config.configuration_hash)
+
+ expect(described_class.gitlab_schemas_for_connection(new_connection)).to be_nil
+ ensure
+ new_connection&.disconnect!
+ end
end
describe '#true_value' do