diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-30 06:09:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-30 06:09:54 +0300 |
commit | c74f7b6ff54ab900d2585ff216cce78d619b183c (patch) | |
tree | d2841380127d6b3e2526b3cc47562c3cca4bc49a /spec | |
parent | d210b1bee140e0f2c1f09635dd14a872e07a3100 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
20 files changed, 259 insertions, 148 deletions
diff --git a/spec/components/pajamas/alert_component_spec.rb b/spec/components/pajamas/alert_component_spec.rb index c60724c7b78..4a90a9e0b88 100644 --- a/spec/components/pajamas/alert_component_spec.rb +++ b/spec/components/pajamas/alert_component_spec.rb @@ -45,11 +45,37 @@ RSpec.describe Pajamas::AlertComponent, :aggregate_failures, type: :component do end end + describe 'title' do + before do + render_inline described_class.new(title: title) + end + + context 'with non-empty string' do + let(:title) { '_title_' } + + it 'sets the title' do + expect(page).to have_selector('.gl-alert-title') + expect(page).to have_content(title) + expect(page).not_to have_selector('.gl-alert-icon-no-title') + end + end + + context 'with nil, empty or blank string' do + where(:title) { [nil, '', ' '] } + + with_them do + it 'does not set a title' do + expect(page).not_to have_selector('.gl-alert-title') + expect(page).to have_selector('.gl-alert-icon-no-title') + end + end + end + end + context 'with custom options' do context 'with simple options' do before do render_inline described_class.new( - title: '_title_', alert_options: { class: '_alert_class_', data: { @@ -60,12 +86,6 @@ RSpec.describe Pajamas::AlertComponent, :aggregate_failures, type: :component do ) end - it 'sets the title' do - expect(page).to have_selector('.gl-alert-title') - expect(page).to have_content('_title_') - expect(page).not_to have_selector('.gl-alert-icon-no-title') - end - it 'sets the alert_class' do expect(page).to have_selector('._alert_class_') end @@ -129,7 +149,7 @@ RSpec.describe Pajamas::AlertComponent, :aggregate_failures, type: :component do end context 'with setting variant type' do - where(:variant) { [:warning, :success, :danger, :tip] } + where(:variant) { [:warning, "success", :danger, "tip"] } before do render_inline described_class.new(variant: variant) @@ -138,7 +158,18 @@ RSpec.describe Pajamas::AlertComponent, :aggregate_failures, type: :component do with_them do it 'renders the variant' do expect(page).to have_selector(".gl-alert-#{variant}") - expect(page).to have_selector("[data-testid='#{described_class::ICONS[variant]}-icon']") + expect(page).to have_selector("[data-testid='#{described_class::VARIANT_ICONS[variant.to_sym]}-icon']") + end + end + + context "with unknown or nil variant" do + where(:variant) { [:foo, nil] } + + with_them do + it "adds the default variant class" do + expect(page).to have_selector(".gl-alert-info") + expect(page).to have_selector("[data-testid='information-o-icon']") + end end end end diff --git a/spec/components/previews/pajamas/alert_component_preview.rb b/spec/components/previews/pajamas/alert_component_preview.rb index 9a6b77715f5..e1889032c8b 100644 --- a/spec/components/previews/pajamas/alert_component_preview.rb +++ b/spec/components/previews/pajamas/alert_component_preview.rb @@ -1,12 +1,13 @@ # frozen_string_literal: true module Pajamas class AlertComponentPreview < ViewComponent::Preview + # @param title text # @param body text # @param dismissible toggle # @param variant select [info, warning, success, danger, tip] - def default(body: nil, dismissible: true, variant: :info) + def default(title: "Alert title (optional)", body: "Alert message goes here.", dismissible: true, variant: :info) render(Pajamas::AlertComponent.new( - title: "Title", + title: title, dismissible: dismissible, variant: variant.to_sym )) do |c| diff --git a/spec/initializers/sidekiq_spec.rb b/spec/initializers/sidekiq_spec.rb index e34f59c3427..063dddd8c46 100644 --- a/spec/initializers/sidekiq_spec.rb +++ b/spec/initializers/sidekiq_spec.rb @@ -42,4 +42,61 @@ RSpec.describe 'sidekiq' do it { is_expected.to be_falsey } end end + + describe 'load_cron_jobs!' do + subject { load_cron_jobs! } + + let(:cron_for_service_ping) { '4 7 * * 4' } + + let(:cron_jobs_settings) do + { + 'gitlab_service_ping_worker' => { + 'cron' => nil, + 'job_class' => 'GitlabServicePingWorker' + }, + 'import_export_project_cleanup_worker' => { + 'cron' => '0 * * * *', + 'job_class' => 'ImportExportProjectCleanupWorker' + }, + "invalid_worker" => { + 'cron' => '0 * * * *' + } + } + end + + let(:cron_jobs_hash) do + { + 'gitlab_service_ping_worker' => { + 'cron' => cron_for_service_ping, + 'class' => 'GitlabServicePingWorker' + }, + 'import_export_project_cleanup_worker' => { + 'cron' => '0 * * * *', + 'class' => 'ImportExportProjectCleanupWorker' + } + } + end + + around do |example| + original_settings = Gitlab.config['cron_jobs'] + Gitlab.config['cron_jobs'] = cron_jobs_settings + + example.run + + Gitlab.config['cron_jobs'] = original_settings + end + + it 'loads the cron jobs into sidekiq-cron' do + allow(Settings).to receive(:cron_for_service_ping).and_return(cron_for_service_ping) + + expect(Sidekiq::Cron::Job).to receive(:load_from_hash!).with(cron_jobs_hash) + + if Gitlab.ee? + expect(Gitlab::Mirror).to receive(:configure_cron_job!) + expect(Gitlab::Geo).to receive(:configure_cron_jobs!) + end + + subject + end + end end diff --git a/spec/lib/gitlab/database/each_database_spec.rb b/spec/lib/gitlab/database/each_database_spec.rb index 2a6eb8f779d..75b543bee85 100644 --- a/spec/lib/gitlab/database/each_database_spec.rb +++ b/spec/lib/gitlab/database/each_database_spec.rb @@ -93,12 +93,13 @@ RSpec.describe Gitlab::Database::EachDatabase do end it 'yields each model with SharedModel connected to each database connection' do - expect_yielded_models([model1, model2], [ - { model: model1, connection: ActiveRecord::Base.connection, name: 'main' }, - { model: model1, connection: Ci::ApplicationRecord.connection, name: 'ci' }, - { model: model2, connection: ActiveRecord::Base.connection, name: 'main' }, - { model: model2, connection: Ci::ApplicationRecord.connection, name: 'ci' } - ]) + expect_yielded_models([model1, model2], + [ + { model: model1, connection: ActiveRecord::Base.connection, name: 'main' }, + { model: model1, connection: Ci::ApplicationRecord.connection, name: 'ci' }, + { model: model2, connection: ActiveRecord::Base.connection, name: 'main' }, + { model: model2, connection: Ci::ApplicationRecord.connection, name: 'ci' } + ]) end context 'when the model limits connection names' do @@ -108,10 +109,11 @@ RSpec.describe Gitlab::Database::EachDatabase do end it 'only yields the model with SharedModel connected to the limited connections' do - expect_yielded_models([model1, model2], [ - { model: model1, connection: ActiveRecord::Base.connection, name: 'main' }, - { model: model2, connection: Ci::ApplicationRecord.connection, name: 'ci' } - ]) + expect_yielded_models([model1, model2], + [ + { model: model1, connection: ActiveRecord::Base.connection, name: 'main' }, + { model: model2, connection: Ci::ApplicationRecord.connection, name: 'ci' } + ]) end end end @@ -132,10 +134,11 @@ RSpec.describe Gitlab::Database::EachDatabase do end it 'yields each model after connecting SharedModel' do - expect_yielded_models([main_model, ci_model], [ - { model: main_model, connection: main_connection, name: 'main' }, - { model: ci_model, connection: ci_connection, name: 'ci' } - ]) + expect_yielded_models([main_model, ci_model], + [ + { model: main_model, connection: main_connection, name: 'main' }, + { model: ci_model, connection: ci_connection, name: 'ci' } + ]) end end @@ -154,21 +157,23 @@ RSpec.describe Gitlab::Database::EachDatabase do context 'when a single name is passed in' do it 'yields models only connected to the given database' do - expect_yielded_models([main_model, ci_model, shared_model], [ - { model: ci_model, connection: Ci::ApplicationRecord.connection, name: 'ci' }, - { model: shared_model, connection: Ci::ApplicationRecord.connection, name: 'ci' } - ], only_on: 'ci') + expect_yielded_models([main_model, ci_model, shared_model], + [ + { model: ci_model, connection: Ci::ApplicationRecord.connection, name: 'ci' }, + { model: shared_model, connection: Ci::ApplicationRecord.connection, name: 'ci' } + ], only_on: 'ci') end end context 'when a list of names are passed in' do it 'yields models only connected to the given databases' do - expect_yielded_models([main_model, ci_model, shared_model], [ - { model: main_model, connection: ActiveRecord::Base.connection, name: 'main' }, - { model: ci_model, connection: Ci::ApplicationRecord.connection, name: 'ci' }, - { model: shared_model, connection: ActiveRecord::Base.connection, name: 'main' }, - { model: shared_model, connection: Ci::ApplicationRecord.connection, name: 'ci' } - ], only_on: %i[main ci]) + expect_yielded_models([main_model, ci_model, shared_model], + [ + { model: main_model, connection: ActiveRecord::Base.connection, name: 'main' }, + { model: ci_model, connection: Ci::ApplicationRecord.connection, name: 'ci' }, + { model: shared_model, connection: ActiveRecord::Base.connection, name: 'main' }, + { model: shared_model, connection: Ci::ApplicationRecord.connection, name: 'ci' } + ], only_on: %i[main ci]) end end end diff --git a/spec/lib/gitlab/database/load_balancing/rack_middleware_spec.rb b/spec/lib/gitlab/database/load_balancing/rack_middleware_spec.rb index a1c141af537..713bff5feea 100644 --- a/spec/lib/gitlab/database/load_balancing/rack_middleware_spec.rb +++ b/spec/lib/gitlab/database/load_balancing/rack_middleware_spec.rb @@ -9,10 +9,10 @@ RSpec.describe Gitlab::Database::LoadBalancing::RackMiddleware, :redis do let(:single_sticking_object) { Set.new([[ActiveRecord::Base.sticking, :user, 42]]) } let(:multiple_sticking_objects) do Set.new([ - [ActiveRecord::Base.sticking, :user, 42], - [ActiveRecord::Base.sticking, :runner, '123456789'], - [ActiveRecord::Base.sticking, :runner, '1234'] - ]) + [ActiveRecord::Base.sticking, :user, 42], + [ActiveRecord::Base.sticking, :runner, '123456789'], + [ActiveRecord::Base.sticking, :runner, '1234'] + ]) end after do @@ -182,11 +182,12 @@ RSpec.describe Gitlab::Database::LoadBalancing::RackMiddleware, :redis do it 'returns the sticking object' do env = { described_class::STICK_OBJECT => multiple_sticking_objects } - expect(middleware.sticking_namespaces(env)).to eq([ - [ActiveRecord::Base.sticking, :user, 42], - [ActiveRecord::Base.sticking, :runner, '123456789'], - [ActiveRecord::Base.sticking, :runner, '1234'] - ]) + expect(middleware.sticking_namespaces(env)).to eq( + [ + [ActiveRecord::Base.sticking, :user, 42], + [ActiveRecord::Base.sticking, :runner, '123456789'], + [ActiveRecord::Base.sticking, :runner, '1234'] + ]) end end diff --git a/spec/lib/gitlab/database/load_balancing/sticking_spec.rb b/spec/lib/gitlab/database/load_balancing/sticking_spec.rb index 2ffb2c32c32..1e316c55786 100644 --- a/spec/lib/gitlab/database/load_balancing/sticking_spec.rb +++ b/spec/lib/gitlab/database/load_balancing/sticking_spec.rb @@ -41,10 +41,12 @@ RSpec.describe Gitlab::Database::LoadBalancing::Sticking, :redis do sticking.stick_or_unstick_request(env, :user, 42) sticking.stick_or_unstick_request(env, :runner, '123456789') - expect(env[Gitlab::Database::LoadBalancing::RackMiddleware::STICK_OBJECT].to_a).to eq([ - [sticking, :user, 42], - [sticking, :runner, '123456789'] - ]) + expect(env[Gitlab::Database::LoadBalancing::RackMiddleware::STICK_OBJECT].to_a).to eq( + [ + [sticking, :user, 42], + [sticking, :runner, + '123456789'] + ]) end end diff --git a/spec/lib/gitlab/database/obsolete_ignored_columns_spec.rb b/spec/lib/gitlab/database/obsolete_ignored_columns_spec.rb index 8a35d8149ad..b39b273bba9 100644 --- a/spec/lib/gitlab/database/obsolete_ignored_columns_spec.rb +++ b/spec/lib/gitlab/database/obsolete_ignored_columns_spec.rb @@ -53,15 +53,16 @@ RSpec.describe Gitlab::Database::ObsoleteIgnoredColumns do describe '#execute' do it 'returns a list of class names and columns pairs' do travel_to(REMOVE_DATE) do - expect(subject.execute).to eq([ - ['Testing::A', { - 'unused' => IgnorableColumns::ColumnIgnore.new(Date.parse('2019-01-01'), '12.0'), - 'also_unused' => IgnorableColumns::ColumnIgnore.new(Date.parse('2019-02-01'), '12.1') - }], - ['Testing::B', { - 'other' => IgnorableColumns::ColumnIgnore.new(Date.parse('2019-01-01'), '12.0') - }] - ]) + expect(subject.execute).to eq( + [ + ['Testing::A', { + 'unused' => IgnorableColumns::ColumnIgnore.new(Date.parse('2019-01-01'), '12.0'), + 'also_unused' => IgnorableColumns::ColumnIgnore.new(Date.parse('2019-02-01'), '12.1') + }], + ['Testing::B', { + 'other' => IgnorableColumns::ColumnIgnore.new(Date.parse('2019-01-01'), '12.0') + }] + ]) end end end diff --git a/spec/lib/gitlab/database/partitioning/monthly_strategy_spec.rb b/spec/lib/gitlab/database/partitioning/monthly_strategy_spec.rb index 67d80d71e2a..50115a6f3dd 100644 --- a/spec/lib/gitlab/database/partitioning/monthly_strategy_spec.rb +++ b/spec/lib/gitlab/database/partitioning/monthly_strategy_spec.rb @@ -29,10 +29,11 @@ RSpec.describe Gitlab::Database::Partitioning::MonthlyStrategy do end it 'detects both partitions' do - expect(subject).to eq([ - Gitlab::Database::Partitioning::TimePartition.new(table_name, nil, '2020-05-01', partition_name: '_test_partitioned_test_000000'), - Gitlab::Database::Partitioning::TimePartition.new(table_name, '2020-05-01', '2020-06-01', partition_name: '_test_partitioned_test_202005') - ]) + expect(subject).to eq( + [ + Gitlab::Database::Partitioning::TimePartition.new(table_name, nil, '2020-05-01', partition_name: '_test_partitioned_test_000000'), + Gitlab::Database::Partitioning::TimePartition.new(table_name, '2020-05-01', '2020-06-01', partition_name: '_test_partitioned_test_202005') + ]) end end diff --git a/spec/lib/gitlab/database/partitioning/sliding_list_strategy_spec.rb b/spec/lib/gitlab/database/partitioning/sliding_list_strategy_spec.rb index 07c2c6606d8..550f254c4da 100644 --- a/spec/lib/gitlab/database/partitioning/sliding_list_strategy_spec.rb +++ b/spec/lib/gitlab/database/partitioning/sliding_list_strategy_spec.rb @@ -36,14 +36,15 @@ RSpec.describe Gitlab::Database::Partitioning::SlidingListStrategy do describe '#current_partitions' do it 'detects both partitions' do - expect(strategy.current_partitions).to eq([ - Gitlab::Database::Partitioning::SingleNumericListPartition.new( - table_name, 1, partition_name: '_test_partitioned_test_1' - ), - Gitlab::Database::Partitioning::SingleNumericListPartition.new( - table_name, 2, partition_name: '_test_partitioned_test_2' - ) - ]) + expect(strategy.current_partitions).to eq( + [ + Gitlab::Database::Partitioning::SingleNumericListPartition.new( + table_name, 1, partition_name: '_test_partitioned_test_1' + ), + Gitlab::Database::Partitioning::SingleNumericListPartition.new( + table_name, 2, partition_name: '_test_partitioned_test_2' + ) + ]) end end diff --git a/spec/lib/gitlab/database/partitioning/time_partition_spec.rb b/spec/lib/gitlab/database/partitioning/time_partition_spec.rb index 700202d81c5..5a17e8d20cf 100644 --- a/spec/lib/gitlab/database/partitioning/time_partition_spec.rb +++ b/spec/lib/gitlab/database/partitioning/time_partition_spec.rb @@ -156,12 +156,13 @@ RSpec.describe Gitlab::Database::Partitioning::TimePartition do described_class.new(table, '2020-03-01', '2020-04-01') ] - expect(partitions.sort).to eq([ - described_class.new(table, nil, '2020-02-01'), - described_class.new(table, '2020-02-01', '2020-03-01'), - described_class.new(table, '2020-03-01', '2020-04-01'), - described_class.new(table, '2020-04-01', '2020-05-01') - ]) + expect(partitions.sort).to eq( + [ + described_class.new(table, nil, '2020-02-01'), + described_class.new(table, '2020-02-01', '2020-03-01'), + described_class.new(table, '2020-03-01', '2020-04-01'), + described_class.new(table, '2020-04-01', '2020-05-01') + ]) end it 'returns nil for partitions of different tables' do diff --git a/spec/lib/gitlab/database/partitioning_spec.rb b/spec/lib/gitlab/database/partitioning_spec.rb index 94cdbfb2328..db5ca890155 100644 --- a/spec/lib/gitlab/database/partitioning_spec.rb +++ b/spec/lib/gitlab/database/partitioning_spec.rb @@ -130,12 +130,14 @@ RSpec.describe Gitlab::Database::Partitioning do context 'when no partitioned models are given' do it 'manages partitions for each registered model' do described_class.register_models([models.first]) - described_class.register_tables([ - { - table_name: table_names.last, - partitioned_column: :created_at, strategy: :monthly - } - ]) + described_class.register_tables( + [ + { + table_name: table_names.last, + partitioned_column: :created_at, + strategy: :monthly + } + ]) expect { described_class.sync_partitions } .to change { find_partitions(table_names.first).size }.from(0) diff --git a/spec/lib/gitlab/database/similarity_score_spec.rb b/spec/lib/gitlab/database/similarity_score_spec.rb index b7b66494390..cfee70ed208 100644 --- a/spec/lib/gitlab/database/similarity_score_spec.rb +++ b/spec/lib/gitlab/database/similarity_score_spec.rb @@ -78,10 +78,11 @@ RSpec.describe Gitlab::Database::SimilarityScore do describe 'score multiplier' do let(:order_expression) do - Gitlab::Database::SimilarityScore.build_expression(search: search, rules: [ - { column: Arel.sql('path'), multiplier: 1 }, - { column: Arel.sql('name'), multiplier: 0.8 } - ]).to_sql + Gitlab::Database::SimilarityScore.build_expression(search: search, rules: + [ + { column: Arel.sql('path'), multiplier: 1 }, + { column: Arel.sql('name'), multiplier: 0.8 } + ]).to_sql end let(:search) { 'different' } @@ -93,10 +94,11 @@ RSpec.describe Gitlab::Database::SimilarityScore do describe 'annotation' do it 'annotates the generated SQL expression' do - expression = Gitlab::Database::SimilarityScore.build_expression(search: 'test', rules: [ - { column: Arel.sql('path'), multiplier: 1 }, - { column: Arel.sql('name'), multiplier: 0.8 } - ]) + expression = Gitlab::Database::SimilarityScore.build_expression(search: 'test', rules: + [ + { column: Arel.sql('path'), multiplier: 1 }, + { column: Arel.sql('name'), multiplier: 0.8 } + ]) expect(Gitlab::Database::SimilarityScore).to be_order_by_similarity(expression) end diff --git a/spec/lib/gitlab/diff/char_diff_spec.rb b/spec/lib/gitlab/diff/char_diff_spec.rb index d38008c16f2..ca0ed6e840d 100644 --- a/spec/lib/gitlab/diff/char_diff_spec.rb +++ b/spec/lib/gitlab/diff/char_diff_spec.rb @@ -20,22 +20,24 @@ RSpec.describe Gitlab::Diff::CharDiff do it 'treats nil values as blank strings' do changes = subject.generate_diff - expect(changes).to eq([ - [:insert, "Hello \n World"] - ]) + expect(changes).to eq( + [ + [:insert, "Hello \n World"] + ]) end end it 'generates an array of changes' do changes = subject.generate_diff - expect(changes).to eq([ - [:equal, "Hel"], - [:insert, "l"], - [:equal, "o \n Worl"], - [:delete, "l"], - [:equal, "d"] - ]) + expect(changes).to eq( + [ + [:equal, "Hel"], + [:insert, "l"], + [:equal, "o \n Worl"], + [:delete, "l"], + [:equal, "d"] + ]) end end diff --git a/spec/lib/gitlab/diff/file_collection_sorter_spec.rb b/spec/lib/gitlab/diff/file_collection_sorter_spec.rb index ca9c156c1ad..3f0b0ad5775 100644 --- a/spec/lib/gitlab/diff/file_collection_sorter_spec.rb +++ b/spec/lib/gitlab/diff/file_collection_sorter_spec.rb @@ -33,27 +33,28 @@ RSpec.describe Gitlab::Diff::FileCollectionSorter do let(:sorted_files_paths) { subject.sort.map { |file| file.new_path.presence || file.old_path } } it 'returns list sorted directory first' do - expect(sorted_files_paths).to eq([ - '.dir/test', - '1-folder/nested/A-file.ext', - '1-folder/nested/M-file.ext', - '1-folder/nested/Z-file.ext', - '1-folder/A-file.ext', - '1-folder/M-file.ext', - '1-folder/README', - '1-folder/README', - '1-folder/Z-file.ext', - '2-folder/nested/A-file.ext', - '2-folder/A-file.ext', - '2-folder/M-file.ext', - '2-folder/Z-file.ext', - '.file', - 'A-file.ext', - 'M-file.ext', - 'README', - 'README', - 'Z-file.ext' - ]) + expect(sorted_files_paths).to eq( + [ + '.dir/test', + '1-folder/nested/A-file.ext', + '1-folder/nested/M-file.ext', + '1-folder/nested/Z-file.ext', + '1-folder/A-file.ext', + '1-folder/M-file.ext', + '1-folder/README', + '1-folder/README', + '1-folder/Z-file.ext', + '2-folder/nested/A-file.ext', + '2-folder/A-file.ext', + '2-folder/M-file.ext', + '2-folder/Z-file.ext', + '.file', + 'A-file.ext', + 'M-file.ext', + 'README', + 'README', + 'Z-file.ext' + ]) end end end diff --git a/spec/lib/gitlab/error_tracking/stack_trace_highlight_decorator_spec.rb b/spec/lib/gitlab/error_tracking/stack_trace_highlight_decorator_spec.rb index 3d23249d00d..73ebee49169 100644 --- a/spec/lib/gitlab/error_tracking/stack_trace_highlight_decorator_spec.rb +++ b/spec/lib/gitlab/error_tracking/stack_trace_highlight_decorator_spec.rb @@ -53,9 +53,9 @@ RSpec.describe Gitlab::ErrorTracking::StackTraceHighlightDecorator do 'lineNo' => 3, 'filename' => 'hello_world.php', 'context' => [ - [1, '<span id="LC1" class="line" lang="hack"><span class="c1">// PHP/Hack example</span></span>'], - [2, '<span id="LC1" class="line" lang="hack"><span class="cp"><?php</span></span>'], - [3, '<span id="LC1" class="line" lang="hack"><span class="k">echo</span> <span class="s1">\'Hello, World!\'</span><span class="p">;</span></span>'] + [1, '<span id="LC1" class="line" lang="hack"><span class="c1">// PHP/Hack example</span></span>'], + [2, '<span id="LC1" class="line" lang="hack"><span class="cp"><?php</span></span>'], + [3, '<span id="LC1" class="line" lang="hack"><span class="k">echo</span> <span class="s1">\'Hello, World!\'</span><span class="p">;</span></span>'] ] }, { diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb index 52c6557b93b..dc0c97e8930 100644 --- a/spec/lib/gitlab/git/repository_spec.rb +++ b/spec/lib/gitlab/git/repository_spec.rb @@ -1769,12 +1769,13 @@ RSpec.describe Gitlab::Git::Repository do it 'returns exactly the expected results' do languages = repository.languages(TestEnv::BRANCH_SHA['master']) - expect(languages).to match_array([ - { value: a_value_within(0.1).of(66.7), label: "Ruby", color: "#701516", highlight: "#701516" }, - { value: a_value_within(0.1).of(22.96), label: "JavaScript", color: "#f1e05a", highlight: "#f1e05a" }, - { value: a_value_within(0.1).of(7.9), label: "HTML", color: "#e34c26", highlight: "#e34c26" }, - { value: a_value_within(0.1).of(2.51), label: "CoffeeScript", color: "#244776", highlight: "#244776" } - ]) + expect(languages).to match_array( + [ + { value: a_value_within(0.1).of(66.7), label: "Ruby", color: "#701516", highlight: "#701516" }, + { value: a_value_within(0.1).of(22.96), label: "JavaScript", color: "#f1e05a", highlight: "#f1e05a" }, + { value: a_value_within(0.1).of(7.9), label: "HTML", color: "#e34c26", highlight: "#e34c26" }, + { value: a_value_within(0.1).of(2.51), label: "CoffeeScript", color: "#244776", highlight: "#244776" } + ]) end it "uses the repository's HEAD when no ref is passed" do diff --git a/spec/lib/gitlab/gitaly_client/blob_service_spec.rb b/spec/lib/gitlab/gitaly_client/blob_service_spec.rb index f869c66337e..d02b4492216 100644 --- a/spec/lib/gitlab/gitaly_client/blob_service_spec.rb +++ b/spec/lib/gitlab/gitaly_client/blob_service_spec.rb @@ -174,20 +174,22 @@ RSpec.describe Gitlab::GitalyClient::BlobService do expect(service) .to receive(:list_blobs) .with(gitaly_request_with_params(expected_params), kind_of(Hash)) - .and_return([ - Gitaly::ListBlobsResponse.new(blobs: [ - Gitaly::ListBlobsResponse::Blob.new(oid: "012345", size: 8, data: "0x01"), - Gitaly::ListBlobsResponse::Blob.new(data: "23") - ]), - Gitaly::ListBlobsResponse.new(blobs: [ - Gitaly::ListBlobsResponse::Blob.new(data: "45"), - Gitaly::ListBlobsResponse::Blob.new(oid: "56", size: 4, data: "0x5"), - Gitaly::ListBlobsResponse::Blob.new(data: "6") - ]), - Gitaly::ListBlobsResponse.new(blobs: [ - Gitaly::ListBlobsResponse::Blob.new(oid: "78", size: 4, data: "0x78") + .and_return( + [ + Gitaly::ListBlobsResponse.new( + blobs: [ + Gitaly::ListBlobsResponse::Blob.new(oid: "012345", size: 8, data: "0x01"), + Gitaly::ListBlobsResponse::Blob.new(data: "23") + ]), + Gitaly::ListBlobsResponse.new( + blobs: [ + Gitaly::ListBlobsResponse::Blob.new(data: "45"), + Gitaly::ListBlobsResponse::Blob.new(oid: "56", size: 4, data: "0x5"), + Gitaly::ListBlobsResponse::Blob.new(data: "6") + ]), + Gitaly::ListBlobsResponse.new( + blobs: [Gitaly::ListBlobsResponse::Blob.new(oid: "78", size: 4, data: "0x78")]) ]) - ]) end blobs = subject.to_a diff --git a/spec/lib/gitlab/github_import/importer/diff_notes_importer_spec.rb b/spec/lib/gitlab/github_import/importer/diff_notes_importer_spec.rb index 85d39df7c89..a8dd6b4725d 100644 --- a/spec/lib/gitlab/github_import/importer/diff_notes_importer_spec.rb +++ b/spec/lib/gitlab/github_import/importer/diff_notes_importer_spec.rb @@ -97,9 +97,10 @@ RSpec.describe Gitlab::GithubImport::Importer::DiffNotesImporter do .to receive(:each_object_to_import) .and_yield(github_comment) - expect(Gitlab::GithubImport::ImportDiffNoteWorker).to receive(:bulk_perform_in).with(1.second, [ - [project.id, an_instance_of(Hash), an_instance_of(String)] - ], batch_size: 1000, batch_delay: 1.minute) + expect(Gitlab::GithubImport::ImportDiffNoteWorker).to receive(:bulk_perform_in) + .with(1.second, [ + [project.id, an_instance_of(Hash), an_instance_of(String)] + ], batch_size: 1000, batch_delay: 1.minute) waiter = importer.parallel_import diff --git a/spec/lib/gitlab/usage_data_counters/hll_redis_counter_spec.rb b/spec/lib/gitlab/usage_data_counters/hll_redis_counter_spec.rb index e2685d92425..d1cbad25655 100644 --- a/spec/lib/gitlab/usage_data_counters/hll_redis_counter_spec.rb +++ b/spec/lib/gitlab/usage_data_counters/hll_redis_counter_spec.rb @@ -109,7 +109,6 @@ RSpec.describe Gitlab::UsageDataCounters::HLLRedisCounter, :clean_gitlab_redis_s 'secure', 'importer', 'geo', - 'growth', 'work_items', 'ci_users', 'error_tracking', diff --git a/spec/views/layouts/_flash.html.haml_spec.rb b/spec/views/layouts/_flash.html.haml_spec.rb index 437cb940c9e..d88977b194a 100644 --- a/spec/views/layouts/_flash.html.haml_spec.rb +++ b/spec/views/layouts/_flash.html.haml_spec.rb @@ -28,7 +28,7 @@ RSpec.describe 'layouts/_flash' do let(:flash) { { flash_type => 'This is a closable flash message' } } it 'shows a close button' do - expect(rendered).to include('js-close-icon') + expect(rendered).to include('js-close') end end end @@ -42,7 +42,7 @@ RSpec.describe 'layouts/_flash' do let(:flash) { { flash_type => 'This is a non closable flash message' } } it 'does not show a close button' do - expect(rendered).not_to include('js-close-icon') + expect(rendered).not_to include('js-close') end end end |