diff options
Diffstat (limited to 'spec')
13 files changed, 20 insertions, 17 deletions
diff --git a/spec/fixtures/api/schemas/entities/issue.json b/spec/fixtures/api/schemas/entities/issue.json index 162fb9c8108..9898819ef75 100644 --- a/spec/fixtures/api/schemas/entities/issue.json +++ b/spec/fixtures/api/schemas/entities/issue.json @@ -5,7 +5,7 @@ "iid": { "type": "integer" }, "author_id": { "type": "integer" }, "description": { "type": ["string", "null"] }, - "lock_version": { "type": ["string", "null"] }, + "lock_version": { "type": ["integer", "null"] }, "milestone_id": { "type": ["string", "null"] }, "title": { "type": "string" }, "moved_to_id": { "type": ["integer", "null"] }, diff --git a/spec/fixtures/api/schemas/entities/merge_request_basic.json b/spec/fixtures/api/schemas/entities/merge_request_basic.json index 88a600398b1..ac0a0314455 100644 --- a/spec/fixtures/api/schemas/entities/merge_request_basic.json +++ b/spec/fixtures/api/schemas/entities/merge_request_basic.json @@ -23,7 +23,7 @@ }, "task_status": { "type": "string" }, "task_status_short": { "type": "string" }, - "lock_version": { "type": ["string", "null"] } + "lock_version": { "type": ["integer", "null"] } }, "additionalProperties": false } diff --git a/spec/javascripts/merge_request_spec.js b/spec/javascripts/merge_request_spec.js index 431798c6ec3..cadcc15385f 100644 --- a/spec/javascripts/merge_request_spec.js +++ b/spec/javascripts/merge_request_spec.js @@ -58,7 +58,7 @@ describe('MergeRequest', function() { { merge_request: { description: '- [ ] Task List Item', - lock_version: undefined, + lock_version: 0, update_task: { line_number: lineNumber, line_source: lineSource, index, checked }, }, }, diff --git a/spec/lib/gitlab/background_migration/deserialize_merge_request_diffs_and_commits_spec.rb b/spec/lib/gitlab/background_migration/deserialize_merge_request_diffs_and_commits_spec.rb index e7ff9169f1b..d3f7f1ded16 100644 --- a/spec/lib/gitlab/background_migration/deserialize_merge_request_diffs_and_commits_spec.rb +++ b/spec/lib/gitlab/background_migration/deserialize_merge_request_diffs_and_commits_spec.rb @@ -177,7 +177,7 @@ describe Gitlab::BackgroundMigration::DeserializeMergeRequestDiffsAndCommits, :m end before do - allow_any_instance_of(described_class::MergeRequestDiff::ActiveRecord_Relation) + allow_any_instance_of(ActiveRecord::Relation) .to receive(:update_all).and_raise(exception) end diff --git a/spec/lib/gitlab/import_export/attribute_configuration_spec.rb b/spec/lib/gitlab/import_export/attribute_configuration_spec.rb index 87ab81d8169..ddfbb020a55 100644 --- a/spec/lib/gitlab/import_export/attribute_configuration_spec.rb +++ b/spec/lib/gitlab/import_export/attribute_configuration_spec.rb @@ -29,7 +29,7 @@ describe 'Import/Export attribute configuration' do it 'has no new columns' do relation_names.each do |relation_name| relation_class = relation_class_for_name(relation_name) - relation_attributes = relation_class.new.attributes.keys + relation_attributes = relation_class.new.attributes.keys - relation_class.encrypted_attributes.keys.map(&:to_s) current_attributes = parsed_attributes(relation_name, relation_attributes) safe_attributes = safe_model_attributes[relation_class.to_s].dup || [] diff --git a/spec/models/ci/runner_spec.rb b/spec/models/ci/runner_spec.rb index 2cb581696a0..f735a89f69f 100644 --- a/spec/models/ci/runner_spec.rb +++ b/spec/models/ci/runner_spec.rb @@ -73,9 +73,8 @@ describe Ci::Runner do end it 'fails to save a group assigned to a project runner even if the runner is already saved' do - group_runner - - expect { create(:group, runners: [project_runner]) } + group.runners << project_runner + expect { group.save! } .to raise_error(ActiveRecord::RecordInvalid) end end diff --git a/spec/requests/api/runner_spec.rb b/spec/requests/api/runner_spec.rb index 29515709a74..b331da1acba 100644 --- a/spec/requests/api/runner_spec.rb +++ b/spec/requests/api/runner_spec.rb @@ -68,7 +68,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do post api('/runners'), params: { token: group.runners_token } expect(response).to have_http_status 201 - expect(group.runners.size).to eq(1) + expect(group.runners.reload.size).to eq(1) runner = Ci::Runner.first expect(runner.token).not_to eq(registration_token) expect(runner.token).not_to eq(group.runners_token) diff --git a/spec/requests/rack_attack_global_spec.rb b/spec/requests/rack_attack_global_spec.rb index 49021f5d1b7..a12646ea222 100644 --- a/spec/requests/rack_attack_global_spec.rb +++ b/spec/requests/rack_attack_global_spec.rb @@ -251,8 +251,8 @@ describe 'Rack Attack global throttles' do let(:throttle_setting_prefix) { 'throttle_authenticated_web' } context 'with the token in the query string' do - let(:get_args) { [rss_url(user), nil] } - let(:other_user_get_args) { [rss_url(other_user), nil] } + let(:get_args) { [rss_url(user), params: nil] } + let(:other_user_get_args) { [rss_url(other_user), params: nil] } it_behaves_like 'rate-limited token-authenticated requests' end diff --git a/spec/services/users/destroy_service_spec.rb b/spec/services/users/destroy_service_spec.rb index 1c79af34538..4a5f4509a7b 100644 --- a/spec/services/users/destroy_service_spec.rb +++ b/spec/services/users/destroy_service_spec.rb @@ -210,6 +210,8 @@ describe Users::DestroyService do describe "calls the before/after callbacks" do it 'of project_members' do + expect_any_instance_of(ProjectMember).to receive(:run_callbacks).with(:find).once + expect_any_instance_of(ProjectMember).to receive(:run_callbacks).with(:initialize).once expect_any_instance_of(ProjectMember).to receive(:run_callbacks).with(:destroy).once service.execute(user) @@ -219,6 +221,8 @@ describe Users::DestroyService do group_member = create(:group_member) group_member.group.group_members.create(user: user, access_level: 40) + expect_any_instance_of(GroupMember).to receive(:run_callbacks).with(:find).once + expect_any_instance_of(GroupMember).to receive(:run_callbacks).with(:initialize).once expect_any_instance_of(GroupMember).to receive(:run_callbacks).with(:destroy).once service.execute(user) diff --git a/spec/services/users/migrate_to_ghost_user_service_spec.rb b/spec/services/users/migrate_to_ghost_user_service_spec.rb index b808fa6d91a..40206775aed 100644 --- a/spec/services/users/migrate_to_ghost_user_service_spec.rb +++ b/spec/services/users/migrate_to_ghost_user_service_spec.rb @@ -80,7 +80,7 @@ describe Users::MigrateToGhostUserService do context "when record migration fails with a rollback exception" do before do - expect_any_instance_of(MergeRequest::ActiveRecord_Associations_CollectionProxy) + expect_any_instance_of(ActiveRecord::Associations::CollectionProxy) .to receive(:update_all).and_raise(ActiveRecord::Rollback) end diff --git a/spec/support/helpers/query_recorder.rb b/spec/support/helpers/query_recorder.rb index 7ce63375d34..c4ae62b25e4 100644 --- a/spec/support/helpers/query_recorder.rb +++ b/spec/support/helpers/query_recorder.rb @@ -17,7 +17,7 @@ module ActiveRecord def callback(name, start, finish, message_id, values) show_backtrace(values) if ENV['QUERY_RECORDER_DEBUG'] - if values[:name]&.include?("CACHE") && skip_cached + if values[:cached] && skip_cached @cached << values[:sql] elsif !values[:name]&.include?("SCHEMA") @log << values[:sql] diff --git a/spec/support/helpers/test_request_helpers.rb b/spec/support/helpers/test_request_helpers.rb index 5a84d67bdfc..39e5dafb059 100644 --- a/spec/support/helpers/test_request_helpers.rb +++ b/spec/support/helpers/test_request_helpers.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module TestRequestHelpers - def test_request(remote_ip: '127.0.0.1') - ActionController::TestRequest.new({ remote_ip: remote_ip }, ActionController::TestSession.new) + def test_request(remote_ip: '127.0.0.1', controller: nil) + ActionController::TestRequest.new({ remote_ip: remote_ip }, ActionController::TestSession.new, controller) end end diff --git a/spec/support/services/migrate_to_ghost_user_service_shared_examples.rb b/spec/support/services/migrate_to_ghost_user_service_shared_examples.rb index 62ae95df8c0..1284415da1f 100644 --- a/spec/support/services/migrate_to_ghost_user_service_shared_examples.rb +++ b/spec/support/services/migrate_to_ghost_user_service_shared_examples.rb @@ -45,7 +45,7 @@ shared_examples "migrating a deleted user's associated records to the ghost user context "race conditions" do context "when #{record_class_name} migration fails and is rolled back" do before do - expect_any_instance_of(record_class::ActiveRecord_Associations_CollectionProxy) + expect_any_instance_of(ActiveRecord::Associations::CollectionProxy) .to receive(:update_all).and_raise(ActiveRecord::Rollback) end @@ -66,7 +66,7 @@ shared_examples "migrating a deleted user's associated records to the ghost user context "when #{record_class_name} migration fails with a non-rollback exception" do before do - expect_any_instance_of(record_class::ActiveRecord_Associations_CollectionProxy) + expect_any_instance_of(ActiveRecord::Associations::CollectionProxy) .to receive(:update_all).and_raise(ArgumentError) end |