Commit 5eb34b2f authored by Markus Koller's avatar Markus Koller

Merge branch 'ld-remove-with_diffs-factory-trait' into 'master'

Remove :with_diffs MergeRequest factory trait

See merge request gitlab-org/gitlab!53310
parents 0cfc8c27 4735c99b
......@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe Analytics::MergeRequestMetricsCalculator do
subject { described_class.new(merge_request) }
let_it_be(:merge_request) { create(:merge_request, :merged, :with_diffs, created_at: 31.days.ago) }
let_it_be(:merge_request) { create(:merge_request, :merged, created_at: 31.days.ago) }
let_it_be(:merge_request_note) do
create(:diff_note_on_merge_request, noteable: merge_request, project: merge_request.source_project, author: create(:user))
end
......
......@@ -6,7 +6,7 @@ RSpec.describe EE::API::Entities::Analytics::CodeReview::MergeRequest do
subject(:entity_representation) { described_class.new(merge_request).as_json }
let(:merge_request) do
create(:merge_request, :with_diffs, :with_productivity_metrics,
create(:merge_request, :with_productivity_metrics,
milestone: milestone,
source_project: project,
metrics_data: { first_comment_at: 1.day.ago, merged_at: 1.hour.ago }
......
......@@ -1371,7 +1371,6 @@ RSpec.describe Projects::MergeRequestsController do
describe 'GET test_reports' do
let_it_be(:merge_request) do
create(:merge_request,
:with_diffs,
:with_merge_request_pipeline,
target_project: project,
source_project: project
......@@ -1482,7 +1481,6 @@ RSpec.describe Projects::MergeRequestsController do
describe 'GET accessibility_reports' do
let_it_be(:merge_request) do
create(:merge_request,
:with_diffs,
:with_merge_request_pipeline,
target_project: project,
source_project: project
......@@ -1603,7 +1601,6 @@ RSpec.describe Projects::MergeRequestsController do
describe 'GET codequality_reports' do
let_it_be(:merge_request) do
create(:merge_request,
:with_diffs,
:with_merge_request_pipeline,
target_project: project,
source_project: project
......
......@@ -21,9 +21,6 @@ FactoryBot.define do
merge_status { "can_be_merged" }
trait :with_diffs do
end
trait :jira_title do
title { generate(:jira_title) }
end
......@@ -306,7 +303,7 @@ FactoryBot.define do
factory :closed_merge_request, traits: [:closed]
factory :reopened_merge_request, traits: [:opened]
factory :invalid_merge_request, traits: [:invalid]
factory :merge_request_with_diffs, traits: [:with_diffs]
factory :merge_request_with_diffs
factory :merge_request_with_diff_notes do
after(:create) do |mr|
create(:diff_note_on_merge_request, noteable: mr, project: mr.source_project)
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe 'IDE merge request', :js do
let(:merge_request) { create(:merge_request, :with_diffs, :simple, source_project: project) }
let(:merge_request) { create(:merge_request, :simple, source_project: project) }
let(:project) { create(:project, :public, :repository) }
let(:user) { project.owner }
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe 'User accepts a merge request', :js, :sidekiq_might_not_need_inline do
let(:merge_request) { create(:merge_request, :with_diffs, :simple, source_project: project) }
let(:merge_request) { create(:merge_request, :simple, source_project: project) }
let(:project) { create(:project, :public, :repository) }
let(:user) { create(:user) }
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe 'User reverts a merge request', :js do
let(:merge_request) { create(:merge_request, :with_diffs, :simple, source_project: project) }
let(:merge_request) { create(:merge_request, :simple, source_project: project) }
let(:project) { create(:project, :public, :repository) }
let(:user) { create(:user) }
......
......@@ -10,7 +10,7 @@ RSpec.describe 'Merge Requests > User filters by milestones', :js do
let(:milestone) { create(:milestone, project: project) }
before do
create(:merge_request, :with_diffs, source_project: project)
create(:merge_request, source_project: project)
create(:merge_request, :simple, source_project: project, milestone: milestone)
sign_in(user)
......
......@@ -95,7 +95,7 @@ RSpec.describe 'issuable templates', :js do
let(:bug_template_content) { 'this is merge request bug template' }
let(:template_override_warning) { 'Applying a template will replace the existing issue description.' }
let(:updated_description) { 'updated merge request description' }
let(:merge_request) { create(:merge_request, :with_diffs, source_project: project) }
let(:merge_request) { create(:merge_request, source_project: project) }
before do
project.repository.create_file(
......@@ -154,7 +154,7 @@ RSpec.describe 'issuable templates', :js do
let(:template_content) { 'this is a test "feature-proposal" template' }
let(:fork_user) { create(:user) }
let(:forked_project) { fork_project(project, fork_user, repository: true) }
let(:merge_request) { create(:merge_request, :with_diffs, source_project: forked_project, target_project: project) }
let(:merge_request) { create(:merge_request, source_project: forked_project, target_project: project) }
before do
sign_out(:user)
......
......@@ -22,7 +22,6 @@ RSpec.describe Projects::MergeRequestsController, '(JavaScript fixtures)', type:
let(:merge_request) do
create(
:merge_request,
:with_diffs,
source_project: project,
target_project: project,
description: description
......
......@@ -8,7 +8,7 @@ RSpec.describe Projects::MergeRequests::DiffsController, '(JavaScript fixtures)'
let(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
let(:project) { create(:project, :repository, namespace: namespace, path: 'merge-requests-project') }
let(:user) { project.owner }
let(:merge_request) { create(:merge_request, :with_diffs, source_project: project, target_project: project, description: '- [ ] Task List Item') }
let(:merge_request) { create(:merge_request, source_project: project, target_project: project, description: '- [ ] Task List Item') }
let(:path) { "files/ruby/popen.rb" }
let(:position) do
build(:text_diff_position, :added,
......
......@@ -7,7 +7,7 @@ RSpec.describe ::API::Entities::MergeRequestBasic do
let_it_be(:project) { create(:project, :public) }
let_it_be(:merge_request) { create(:merge_request) }
let_it_be(:labels) { create_list(:label, 3) }
let_it_be(:merge_requests) { create_list(:labeled_merge_request, 10, :unique_branches, :with_diffs, labels: labels) }
let_it_be(:merge_requests) { create_list(:labeled_merge_request, 10, :unique_branches, labels: labels) }
# This mimics the behavior of the `Grape::Entity` serializer
def present(obj)
......
......@@ -216,7 +216,7 @@ RSpec.describe Banzai::Filter::MergeRequestReferenceFilter do
end
context 'URL reference for a commit' do
let(:mr) { create(:merge_request, :with_diffs) }
let(:mr) { create(:merge_request) }
let(:reference) do
urls.project_merge_request_url(mr.project, mr) + "/diffs?commit_id=#{mr.diff_head_sha}"
end
......
......@@ -80,7 +80,7 @@ RSpec.describe MergeRequestDiff do
describe '.by_commit_sha' do
subject(:by_commit_sha) { described_class.by_commit_sha(sha) }
let!(:merge_request) { create(:merge_request, :with_diffs) }
let!(:merge_request) { create(:merge_request) }
context 'with sha contained in' do
let(:sha) { 'b83d6e391c22777fca1ed3012fce84f633d7fed0' }
......@@ -358,7 +358,7 @@ RSpec.describe MergeRequestDiff do
end
describe '#latest?' do
let!(:mr) { create(:merge_request, :with_diffs) }
let!(:mr) { create(:merge_request) }
let!(:first_diff) { mr.merge_request_diff }
let!(:last_diff) { mr.create_merge_request_diff }
......@@ -367,7 +367,7 @@ RSpec.describe MergeRequestDiff do
end
shared_examples_for 'merge request diffs' do
let(:merge_request) { create(:merge_request, :with_diffs) }
let(:merge_request) { create(:merge_request) }
let!(:diff) { merge_request.merge_request_diff.reload }
context 'when it was not cleaned by the system' do
......
......@@ -365,7 +365,7 @@ RSpec.describe MergeRequest, factory_default: :keep do
describe '.by_commit_sha' do
subject(:by_commit_sha) { described_class.by_commit_sha(sha) }
let!(:merge_request) { create(:merge_request, :with_diffs) }
let!(:merge_request) { create(:merge_request) }
context 'with sha contained in latest merge request diff' do
let(:sha) { 'b83d6e391c22777fca1ed3012fce84f633d7fed0' }
......@@ -431,7 +431,7 @@ RSpec.describe MergeRequest, factory_default: :keep do
end
context 'when commit is a part of the merge request' do
let!(:merge_request) { create(:merge_request, :with_diffs) }
let!(:merge_request) { create(:merge_request) }
let(:sha) { 'b83d6e391c22777fca1ed3012fce84f633d7fed0' }
it { is_expected.to eq([merge_request]) }
......@@ -451,7 +451,7 @@ RSpec.describe MergeRequest, factory_default: :keep do
end
context 'when commit is part of the merge request and a squash commit at the same time' do
let!(:merge_request) { create(:merge_request, :with_diffs) }
let!(:merge_request) { create(:merge_request) }
let(:sha) { merge_request.commits.first.id }
before do
......@@ -825,7 +825,7 @@ RSpec.describe MergeRequest, factory_default: :keep do
let(:last_branch_commit) { subject.source_project.repository.commit(Gitlab::Git::BRANCH_REF_PREFIX + subject.source_branch) }
context 'with diffs' do
subject { create(:merge_request, :with_diffs) }
subject { create(:merge_request) }
it 'returns the sha of the source branch last commit' do
expect(subject.source_branch_sha).to eq(last_branch_commit.sha)
......@@ -892,7 +892,7 @@ RSpec.describe MergeRequest, factory_default: :keep do
let(:options) { { paths: ['a/b', 'b/a', 'c/*'] } }
context 'when there are MR diffs' do
let(:merge_request) { create(:merge_request, :with_diffs) }
let(:merge_request) { create(:merge_request) }
it 'delegates to the MR diffs' do
expect(merge_request.merge_request_diff).to receive(:raw_diffs).with(options)
......@@ -941,7 +941,7 @@ RSpec.describe MergeRequest, factory_default: :keep do
describe '#note_positions_for_paths' do
let(:user) { create(:user) }
let(:merge_request) { create(:merge_request, :with_diffs) }
let(:merge_request) { create(:merge_request) }
let(:project) { merge_request.project }
let!(:diff_note) do
create(:diff_note_on_merge_request, project: project, noteable: merge_request)
......
......@@ -6,7 +6,7 @@ RSpec.describe 'Updating an image DiffNote' do
include GraphqlHelpers
using RSpec::Parameterized::TableSyntax
let_it_be(:noteable) { create(:merge_request, :with_diffs) }
let_it_be(:noteable) { create(:merge_request) }
let_it_be(:original_body) { 'Original body' }
let_it_be(:original_position) do
Gitlab::Diff::Position.new(
......
......@@ -8,9 +8,11 @@ RSpec.describe 'Query.project.mergeRequests.pipelines' do
let_it_be(:project) { create(:project, :public, :repository) }
let_it_be(:author) { create(:user) }
let_it_be(:merge_requests) do
%i[with_diffs with_image_diffs conflict].map do |trait|
create(:merge_request, trait, author: author, source_project: project)
end
[
create(:merge_request, author: author, source_project: project),
create(:merge_request, :with_image_diffs, author: author, source_project: project),
create(:merge_request, :conflict, author: author, source_project: project)
]
end
describe '.count' do
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe PaginatedDiffEntity do
let(:user) { create(:user) }
let(:request) { double('request', current_user: user) }
let(:merge_request) { create(:merge_request, :with_diffs) }
let(:merge_request) { create(:merge_request) }
let(:diff_batch) { merge_request.merge_request_diff.diffs_in_batch(2, 3, diff_options: nil) }
let(:options) do
{
......
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