Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
4735c99b
Commit
4735c99b
authored
Feb 04, 2021
by
Luke Duncalfe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove :with_diffs MergeRequest factory trait
The trait is a no-op and redundant.
parent
9903c502
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
31 additions
and
36 deletions
+31
-36
ee/spec/lib/analytics/merge_request_metrics_calculator_spec.rb
...ec/lib/analytics/merge_request_metrics_calculator_spec.rb
+1
-1
ee/spec/lib/ee/api/entities/analytics/code_review/merge_request_spec.rb
.../api/entities/analytics/code_review/merge_request_spec.rb
+1
-1
spec/controllers/projects/merge_requests_controller_spec.rb
spec/controllers/projects/merge_requests_controller_spec.rb
+0
-3
spec/factories/merge_requests.rb
spec/factories/merge_requests.rb
+1
-4
spec/features/ide/user_opens_merge_request_spec.rb
spec/features/ide/user_opens_merge_request_spec.rb
+1
-1
spec/features/merge_request/user_accepts_merge_request_spec.rb
...features/merge_request/user_accepts_merge_request_spec.rb
+1
-1
spec/features/merge_request/user_reverts_merge_request_spec.rb
...features/merge_request/user_reverts_merge_request_spec.rb
+1
-1
spec/features/merge_requests/user_filters_by_milestones_spec.rb
...eatures/merge_requests/user_filters_by_milestones_spec.rb
+1
-1
spec/features/projects/issuable_templates_spec.rb
spec/features/projects/issuable_templates_spec.rb
+2
-2
spec/frontend/fixtures/merge_requests.rb
spec/frontend/fixtures/merge_requests.rb
+0
-1
spec/frontend/fixtures/merge_requests_diffs.rb
spec/frontend/fixtures/merge_requests_diffs.rb
+1
-1
spec/lib/api/entities/merge_request_basic_spec.rb
spec/lib/api/entities/merge_request_basic_spec.rb
+1
-1
spec/lib/banzai/filter/merge_request_reference_filter_spec.rb
.../lib/banzai/filter/merge_request_reference_filter_spec.rb
+1
-1
spec/models/merge_request_diff_spec.rb
spec/models/merge_request_diff_spec.rb
+3
-3
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+9
-9
spec/requests/api/graphql/mutations/notes/update/image_diff_note_spec.rb
...pi/graphql/mutations/notes/update/image_diff_note_spec.rb
+1
-1
spec/requests/api/graphql/project/merge_request/pipelines_spec.rb
...uests/api/graphql/project/merge_request/pipelines_spec.rb
+5
-3
spec/serializers/paginated_diff_entity_spec.rb
spec/serializers/paginated_diff_entity_spec.rb
+1
-1
No files found.
ee/spec/lib/analytics/merge_request_metrics_calculator_spec.rb
View file @
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
...
...
ee/spec/lib/ee/api/entities/analytics/code_review/merge_request_spec.rb
View file @
4735c99b
...
...
@@ -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
}
...
...
spec/controllers/projects/merge_requests_controller_spec.rb
View file @
4735c99b
...
...
@@ -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
...
...
spec/factories/merge_requests.rb
View file @
4735c99b
...
...
@@ -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
)
...
...
spec/features/ide/user_opens_merge_request_spec.rb
View file @
4735c99b
...
...
@@ -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
}
...
...
spec/features/merge_request/user_accepts_merge_request_spec.rb
View file @
4735c99b
...
...
@@ -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
)
}
...
...
spec/features/merge_request/user_reverts_merge_request_spec.rb
View file @
4735c99b
...
...
@@ -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
)
}
...
...
spec/features/merge_requests/user_filters_by_milestones_spec.rb
View file @
4735c99b
...
...
@@ -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
)
...
...
spec/features/projects/issuable_templates_spec.rb
View file @
4735c99b
...
...
@@ -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
)
...
...
spec/frontend/fixtures/merge_requests.rb
View file @
4735c99b
...
...
@@ -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
...
...
spec/frontend/fixtures/merge_requests_diffs.rb
View file @
4735c99b
...
...
@@ -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
,
...
...
spec/lib/api/entities/merge_request_basic_spec.rb
View file @
4735c99b
...
...
@@ -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
)
...
...
spec/lib/banzai/filter/merge_request_reference_filter_spec.rb
View file @
4735c99b
...
...
@@ -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
...
...
spec/models/merge_request_diff_spec.rb
View file @
4735c99b
...
...
@@ -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
...
...
spec/models/merge_request_spec.rb
View file @
4735c99b
...
...
@@ -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
...
...
@@ -817,7 +817,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
)
...
...
@@ -884,7 +884,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
)
...
...
@@ -933,7 +933,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
)
...
...
@@ -3444,7 +3444,7 @@ RSpec.describe MergeRequest, factory_default: :keep do
describe
'#branch_merge_base_commit'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
subject
{
create
(
:merge_request
,
:with_diffs
,
source_project:
project
)
}
subject
{
create
(
:merge_request
,
source_project:
project
)
}
context
'source and target branch exist'
do
it
{
expect
(
subject
.
branch_merge_base_commit
.
sha
).
to
eq
(
'ae73cb07c9eeaf35924a10f713b364d32b2dd34f'
)
}
...
...
@@ -3467,7 +3467,7 @@ RSpec.describe MergeRequest, factory_default: :keep do
context
"with diffs"
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
subject
{
create
(
:merge_request
,
:with_diffs
,
source_project:
project
)
}
subject
{
create
(
:merge_request
,
source_project:
project
)
}
let
(
:expected_diff_refs
)
do
Gitlab
::
Diff
::
DiffRefs
.
new
(
...
...
@@ -3871,7 +3871,7 @@ RSpec.describe MergeRequest, factory_default: :keep do
describe
'#fetch_ref!'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
subject
{
create
(
:merge_request
,
:with_diffs
,
source_project:
project
)
}
subject
{
create
(
:merge_request
,
source_project:
project
)
}
it
'fetches the ref correctly'
do
expect
{
subject
.
target_project
.
repository
.
delete_refs
(
subject
.
ref_path
)
}.
not_to
raise_error
...
...
spec/requests/api/graphql/mutations/notes/update/image_diff_note_spec.rb
View file @
4735c99b
...
...
@@ -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
(
...
...
spec/requests/api/graphql/project/merge_request/pipelines_spec.rb
View file @
4735c99b
...
...
@@ -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
...
...
spec/serializers/paginated_diff_entity_spec.rb
View file @
4735c99b
...
...
@@ -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
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment