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
8818ae8f
Commit
8818ae8f
authored
Feb 23, 2021
by
Igor Drozdov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test for a position without lines
parent
0826e332
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
23 deletions
+13
-23
spec/requests/api/graphql/mutations/notes/create/diff_note_spec.rb
...ests/api/graphql/mutations/notes/create/diff_note_spec.rb
+13
-23
No files found.
spec/requests/api/graphql/mutations/notes/create/diff_note_spec.rb
View file @
8818ae8f
...
...
@@ -9,8 +9,9 @@ RSpec.describe 'Adding a DiffNote' do
let
(
:noteable
)
{
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:diff_refs
)
{
noteable
.
diff_refs
}
let
(
:mutation
)
do
variables
=
{
let
(
:base_variables
)
do
{
noteable_id:
GitlabSchema
.
id_from_object
(
noteable
).
to_s
,
body:
'Body text'
,
position:
{
...
...
@@ -18,16 +19,16 @@ RSpec.describe 'Adding a DiffNote' do
old_path:
'files/ruby/popen.rb'
,
new_path:
'files/ruby/popen2.rb'
},
new_line:
14
,
base_sha:
diff_refs
.
base_sha
,
head_sha:
diff_refs
.
head_sha
,
start_sha:
diff_refs
.
start_sha
}
}
graphql_mutation
(
:create_diff_note
,
variables
)
end
let
(
:variables
)
{
base_variables
.
deep_merge
({
position:
{
new_line:
14
}
})
}
let
(
:mutation
)
{
graphql_mutation
(
:create_diff_note
,
variables
)
}
def
mutation_response
graphql_mutation_response
(
:create_diff_note
)
end
...
...
@@ -42,28 +43,17 @@ RSpec.describe 'Adding a DiffNote' do
it_behaves_like
'a Note mutation that creates a Note'
context
'add comment to old line'
do
let
(
:mutation
)
do
variables
=
{
noteable_id:
GitlabSchema
.
id_from_object
(
noteable
).
to_s
,
body:
'Body text'
,
position:
{
paths:
{
old_path:
'files/ruby/popen.rb'
,
new_path:
'files/ruby/popen.rb'
},
old_line:
14
,
base_sha:
diff_refs
.
base_sha
,
head_sha:
diff_refs
.
head_sha
,
start_sha:
diff_refs
.
start_sha
}
}
graphql_mutation
(
:create_diff_note
,
variables
)
end
let
(
:variables
)
{
base_variables
.
deep_merge
({
position:
{
old_line:
14
}
})
}
it_behaves_like
'a Note mutation that creates a Note'
end
context
'add a comment with a position without lines'
do
let
(
:variables
)
{
base_variables
}
it_behaves_like
'a Note mutation that does not create a Note'
end
it_behaves_like
'a Note mutation when there are active record validation errors'
,
model:
DiffNote
it_behaves_like
'a Note mutation when there are rate limit validation errors'
...
...
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