Commit 80c95503 authored by Jan Provaznik's avatar Jan Provaznik

Merge branch 'id-reset-state-for-tests' into 'master'

Reset state correctly for tests failed in Rails 6.1

See merge request gitlab-org/gitlab!60776
parents e47cb248 a5d10d4c
......@@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe 'User manages merge trains option', :js do
let_it_be(:project) { create(:project) }
let_it_be(:project, refind: true) { create(:project) }
let_it_be(:user) { create(:user) }
before do
......
......@@ -119,7 +119,7 @@ RSpec.describe Gitlab::SeatLinkData do
end
describe '#should_sync_seats?' do
let_it_be(:historical_data) { create(:historical_data, recorded_at: timestamp) }
let_it_be(:historical_data, refind: true) { create(:historical_data, recorded_at: timestamp) }
let(:license) { build(:license, :cloud) }
......
......@@ -8,7 +8,7 @@ RSpec.describe Mutations::Boards::EpicBoards::Destroy do
let_it_be_with_reload(:current_user) { create(:user) }
let_it_be_with_reload(:group) { create(:group) }
let_it_be(:board) { create(:epic_board, group: group) }
let_it_be(:other_board) { create(:epic_board, group: group) }
let_it_be(:other_board, refind: true) { create(:epic_board, group: group) }
let(:mutation) do
variables = {
......
......@@ -5,10 +5,10 @@ require 'spec_helper'
RSpec.describe 'Destroy an epic board list' do
include GraphqlHelpers
let_it_be(:current_user, reload: true) { create(:user) }
let_it_be(:current_user, refind: true) { create(:user) }
let_it_be(:group) { create(:group, :private) }
let_it_be(:board) { create(:epic_board, group: group) }
let_it_be(:list) { create(:epic_list, epic_board: board) }
let_it_be(:list, refind: true) { create(:epic_list, epic_board: board) }
let(:variables) do
{
......
......@@ -8,7 +8,8 @@ RSpec.describe 'Update of an existing issue' do
let_it_be(:group) { create(:group) }
let_it_be(:current_user) { create(:user) }
let_it_be(:project) { create(:project, :public, group: group) }
let_it_be(:issue) { create(:issue, project: project) }
let_it_be(:issue, refind: true) { create(:issue, project: project) }
let(:input) do
{
'iid' => issue.iid.to_s,
......
......@@ -7,7 +7,7 @@ RSpec.describe AppSec::Dast::Profiles::DestroyService do
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project) }
let_it_be(:dast_profile, reload: true) { create(:dast_profile, project: project) }
let_it_be(:dast_profile, refind: true) { create(:dast_profile, project: project) }
subject do
described_class.new(
......
......@@ -8,7 +8,7 @@ RSpec.describe Dast::SiteProfileSecretVariables::DestroyService do
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project) }
let_it_be(:dast_site_profile) { create(:dast_site_profile, project: project) }
let_it_be(:dast_site_profile_secret_variable, reload: true) { create(:dast_site_profile_secret_variable, dast_site_profile: dast_site_profile) }
let_it_be(:dast_site_profile_secret_variable, refind: true) { create(:dast_site_profile_secret_variable, dast_site_profile: dast_site_profile) }
subject do
described_class.new(
......
......@@ -7,7 +7,7 @@ RSpec.describe Geo::RepositoriesCleanUpWorker, :geo do
include ExclusiveLeaseHelpers
describe '#perform' do
let_it_be(:secondary) { create(:geo_node) }
let_it_be(:secondary, refind: true) { create(:geo_node) }
let_it_be(:synced_group) { create(:group) }
let_it_be(:synced_subgroup) { create(:group, parent: synced_group) }
let_it_be(:unsynced_group) { create(:group) }
......
......@@ -3,6 +3,7 @@
require 'spec_helper'
RSpec.describe Gitlab::Ci::Config::Entry::Default do
let(:config) { {} }
let(:entry) { described_class.new(config) }
it_behaves_like 'with inheritable CI config' do
......
......@@ -20,6 +20,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Hidden do
end
describe '.new' do
let(:config) { {} }
let(:entry) { described_class.new(config) }
describe 'validations' do
......@@ -41,8 +42,6 @@ RSpec.describe Gitlab::Ci::Config::Entry::Hidden do
context 'when entry value is not correct' do
context 'when config is empty' do
let(:config) { {} }
describe '#valid' do
it 'is invalid' do
expect(entry).not_to be_valid
......
......@@ -3,6 +3,8 @@
require 'spec_helper'
RSpec.describe Gitlab::Ci::Config::Entry::Kubernetes do
let(:config) { Hash(namespace: 'namespace') }
subject { described_class.new(config) }
describe 'attributes' do
......
......@@ -2815,11 +2815,11 @@ RSpec.describe Project, factory_default: :keep do
end
describe '#remove_import_data' do
let_it_be(:import_data) { ProjectImportData.new(data: { 'test' => 'some data' }) }
let(:import_data) { ProjectImportData.new(data: { 'test' => 'some data' }) }
context 'when jira import' do
let_it_be(:project, reload: true) { create(:project, import_type: 'jira', import_data: import_data) }
let_it_be(:jira_import) { create(:jira_import_state, project: project) }
let!(:project) { create(:project, import_type: 'jira', import_data: import_data) }
let!(:jira_import) { create(:jira_import_state, project: project) }
it 'does remove import data' do
expect(project.mirror?).to be false
......@@ -2829,8 +2829,7 @@ RSpec.describe Project, factory_default: :keep do
end
context 'when neither a mirror nor a jira import' do
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, import_type: 'github', import_data: import_data) }
let!(:project) { create(:project, import_type: 'github', import_data: import_data) }
it 'removes import data' do
expect(project.mirror?).to be false
......
......@@ -8,7 +8,8 @@ RSpec.describe Mutations::Boards::Destroy do
let_it_be(:current_user, reload: true) { create(:user) }
let_it_be(:project, reload: true) { create(:project) }
let_it_be(:board) { create(:board, project: project) }
let_it_be(:other_board) { create(:board, project: project) }
let_it_be(:other_board, refind: true) { create(:board, project: project) }
let(:mutation) do
variables = {
id: GitlabSchema.id_from_object(board).to_s
......
......@@ -10,7 +10,8 @@ RSpec.describe Mutations::Boards::Lists::Destroy do
it_behaves_like 'board lists destroy request' do
let_it_be(:group, reload: true) { create(:group) }
let_it_be(:board) { create(:board, group: group) }
let_it_be(:list) { create(:list, board: board) }
let_it_be(:list, refind: true) { create(:list, board: board) }
let(:variables) do
{
list_id: GitlabSchema.id_from_object(list).to_s
......
......@@ -1335,6 +1335,7 @@ RSpec.describe API::Projects do
describe 'GET /users/:user_id/starred_projects/' do
before do
user3.update!(starred_projects: [project, project2, project3])
user3.reload
end
it 'returns error when user not found' do
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe Ci::CreateDownstreamPipelineService, '#execute' do
let_it_be(:user) { create(:user) }
let(:upstream_project) { create(:project, :repository) }
let_it_be(:downstream_project) { create(:project, :repository) }
let_it_be(:downstream_project, refind: true) { create(:project, :repository) }
let!(:upstream_pipeline) do
create(:ci_pipeline, :running, project: upstream_project)
......
......@@ -161,6 +161,7 @@ RSpec.describe Deployments::UpdateEnvironmentService do
context 'when deployment was created by an external CD system' do
before do
deployment.update_column(:deployable_id, nil)
deployment.reload
end
it 'guesses the deployment tier' do
......
......@@ -7,7 +7,7 @@ RSpec.describe Projects::Prometheus::Alerts::NotifyService do
using RSpec::Parameterized::TableSyntax
let_it_be_with_reload(:project) { create(:project) }
let_it_be_with_reload(:setting) do
let_it_be_with_refind(:setting) do
create(:project_incident_management_setting, project: project, send_email: true, create_issue: true)
end
......
......@@ -41,15 +41,15 @@ RSpec.describe WebHooks::DestroyService do
end
context 'with system hook' do
let_it_be(:hook) { create(:system_hook, url: "http://example.com") }
let_it_be(:log) { create_list(:web_hook_log, 3, web_hook: hook) }
let!(:hook) { create(:system_hook, url: "http://example.com") }
let!(:log) { create_list(:web_hook_log, 3, web_hook: hook) }
it_behaves_like 'batched destroys'
end
context 'with project hook' do
let_it_be(:hook) { create(:project_hook) }
let_it_be(:log) { create_list(:web_hook_log, 3, web_hook: hook) }
let!(:hook) { create(:project_hook) }
let!(:log) { create_list(:web_hook_log, 3, web_hook: hook) }
it_behaves_like 'batched destroys'
end
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe ContainerExpirationPolicies::CleanupContainerRepositoryWorker do
using RSpec::Parameterized::TableSyntax
let_it_be(:repository, reload: true) { create(:container_repository, :cleanup_scheduled) }
let_it_be(:repository, refind: true) { create(:container_repository, :cleanup_scheduled) }
let_it_be(:project) { repository.project }
let_it_be(:policy) { project.container_expiration_policy }
let_it_be(:other_repository) { create(:container_repository) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment