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
3a10bfdb
Commit
3a10bfdb
authored
Apr 05, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
07e418b1
ca72809c
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
228 additions
and
123 deletions
+228
-123
app/assets/javascripts/helpers/monitor_helper.js
app/assets/javascripts/helpers/monitor_helper.js
+17
-0
app/assets/javascripts/monitoring/components/charts/area.vue
app/assets/javascripts/monitoring/components/charts/area.vue
+7
-8
changelogs/unreleased/58717-checkbox-cannot-be-checked-if-a-blockquote-is-above.yml
...7-checkbox-cannot-be-checked-if-a-blockquote-is-above.yml
+5
-0
changelogs/unreleased/59324-queries-which-return-multiple-series-are-not-working-correctly.yml
...hich-return-multiple-series-are-not-working-correctly.yml
+5
-0
lib/banzai/filter/blockquote_fence_filter.rb
lib/banzai/filter/blockquote_fence_filter.rb
+3
-1
spec/features/issues/user_uses_quick_actions_spec.rb
spec/features/issues/user_uses_quick_actions_spec.rb
+2
-19
spec/features/merge_request/user_uses_quick_actions_spec.rb
spec/features/merge_request/user_uses_quick_actions_spec.rb
+1
-78
spec/fixtures/blockquote_fence_after.md
spec/fixtures/blockquote_fence_after.md
+16
-0
spec/frontend/helpers/monitor_helper_spec.js
spec/frontend/helpers/monitor_helper_spec.js
+45
-0
spec/lib/banzai/filter/blockquote_fence_filter_spec.rb
spec/lib/banzai/filter/blockquote_fence_filter_spec.rb
+1
-1
spec/services/issues/build_service_spec.rb
spec/services/issues/build_service_spec.rb
+3
-1
spec/services/task_list_toggle_service_spec.rb
spec/services/task_list_toggle_service_spec.rb
+21
-0
spec/support/shared_examples/quick_actions/issue/remove_due_date_quick_action_shared_examples.rb
...ons/issue/remove_due_date_quick_action_shared_examples.rb
+25
-15
spec/support/shared_examples/quick_actions/merge_request/target_branch_quick_action_shared_examples.rb
...rge_request/target_branch_quick_action_shared_examples.rb
+77
-0
No files found.
app/assets/javascripts/helpers/monitor_helper.js
0 → 100644
View file @
3a10bfdb
/* eslint-disable import/prefer-default-export */
export
const
makeDataSeries
=
(
queryResults
,
defaultConfig
)
=>
queryResults
.
reduce
((
acc
,
result
)
=>
{
const
data
=
result
.
values
.
filter
(([,
value
])
=>
!
Number
.
isNaN
(
value
));
if
(
!
data
.
length
)
{
return
acc
;
}
const
relevantMetric
=
defaultConfig
.
name
.
toLowerCase
().
replace
(
'
'
,
'
_
'
);
const
name
=
result
.
metric
[
relevantMetric
];
const
series
=
{
data
};
if
(
name
)
{
series
.
name
=
`
${
defaultConfig
.
name
}
:
${
name
}
`
;
}
return
acc
.
concat
({
...
defaultConfig
,
...
series
});
},
[]);
app/assets/javascripts/monitoring/components/charts/area.vue
View file @
3a10bfdb
...
@@ -5,6 +5,7 @@ import { debounceByAnimationFrame } from '~/lib/utils/common_utils';
...
@@ -5,6 +5,7 @@ import { debounceByAnimationFrame } from '~/lib/utils/common_utils';
import
{
getSvgIconPathContent
}
from
'
~/lib/utils/icon_utils
'
;
import
{
getSvgIconPathContent
}
from
'
~/lib/utils/icon_utils
'
;
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
import
{
chartHeight
,
graphTypes
,
lineTypes
}
from
'
../../constants
'
;
import
{
chartHeight
,
graphTypes
,
lineTypes
}
from
'
../../constants
'
;
import
{
makeDataSeries
}
from
'
~/helpers/monitor_helper
'
;
let
debouncedResize
;
let
debouncedResize
;
...
@@ -63,7 +64,7 @@ export default {
...
@@ -63,7 +64,7 @@ export default {
},
},
computed
:
{
computed
:
{
chartData
()
{
chartData
()
{
return
this
.
graphData
.
queries
.
map
(
query
=>
{
return
this
.
graphData
.
queries
.
reduce
((
acc
,
query
)
=>
{
const
{
appearance
}
=
query
;
const
{
appearance
}
=
query
;
const
lineType
=
const
lineType
=
appearance
&&
appearance
.
line
&&
appearance
.
line
.
type
appearance
&&
appearance
.
line
&&
appearance
.
line
.
type
...
@@ -74,9 +75,8 @@ export default {
...
@@ -74,9 +75,8 @@ export default {
?
appearance
.
line
.
width
?
appearance
.
line
.
width
:
undefined
;
:
undefined
;
return
{
const
series
=
makeDataSeries
(
query
.
result
,
{
name
:
this
.
formatLegendLabel
(
query
),
name
:
this
.
formatLegendLabel
(
query
),
data
:
this
.
concatenateResults
(
query
.
result
),
lineStyle
:
{
lineStyle
:
{
type
:
lineType
,
type
:
lineType
,
width
:
lineWidth
,
width
:
lineWidth
,
...
@@ -87,8 +87,10 @@ export default {
...
@@ -87,8 +87,10 @@ export default {
?
appearance
.
area
.
opacity
?
appearance
.
area
.
opacity
:
undefined
,
:
undefined
,
},
},
};
});
});
return
acc
.
concat
(
series
);
},
[]);
},
},
chartOptions
()
{
chartOptions
()
{
return
{
return
{
...
@@ -175,9 +177,6 @@ export default {
...
@@ -175,9 +177,6 @@ export default {
this
.
setSvg
(
'
scroll-handle
'
);
this
.
setSvg
(
'
scroll-handle
'
);
},
},
methods
:
{
methods
:
{
concatenateResults
(
results
)
{
return
results
.
reduce
((
acc
,
result
)
=>
acc
.
concat
(
result
.
values
),
[]);
},
formatLegendLabel
(
query
)
{
formatLegendLabel
(
query
)
{
return
`
${
query
.
label
}
`
;
return
`
${
query
.
label
}
`
;
},
},
...
...
changelogs/unreleased/58717-checkbox-cannot-be-checked-if-a-blockquote-is-above.yml
0 → 100644
View file @
3a10bfdb
---
title
:
Allow task lists that follow a blockquote to work correctly
merge_request
:
26937
author
:
type
:
fixed
changelogs/unreleased/59324-queries-which-return-multiple-series-are-not-working-correctly.yml
0 → 100644
View file @
3a10bfdb
---
title
:
Fix multiple series queries on metrics dashboard
merge_request
:
26514
author
:
type
:
fixed
lib/banzai/filter/blockquote_fence_filter.rb
View file @
3a10bfdb
...
@@ -42,7 +42,9 @@ module Banzai
...
@@ -42,7 +42,9 @@ module Banzai
def
call
def
call
@text
.
gsub
(
REGEX
)
do
@text
.
gsub
(
REGEX
)
do
if
$~
[
:quote
]
if
$~
[
:quote
]
$~
[
:quote
].
gsub
(
/^/
,
"> "
).
gsub
(
/^> $/
,
">"
)
# keep the same number of source lines/positions by replacing the
# fence lines with newlines
"
\n
"
+
$~
[
:quote
].
gsub
(
/^/
,
"> "
).
gsub
(
/^> $/
,
">"
)
+
"
\n
"
else
else
$~
[
0
]
$~
[
0
]
end
end
...
...
spec/features/issues/user_uses_quick_actions_spec.rb
View file @
3a10bfdb
...
@@ -43,7 +43,7 @@ describe 'Issues > User uses quick actions', :js do
...
@@ -43,7 +43,7 @@ describe 'Issues > User uses quick actions', :js do
describe
'issue-only commands'
do
describe
'issue-only commands'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
due_date:
Date
.
new
(
2016
,
8
,
28
)
)
}
before
do
before
do
project
.
add_maintainer
(
user
)
project
.
add_maintainer
(
user
)
...
@@ -57,6 +57,7 @@ describe 'Issues > User uses quick actions', :js do
...
@@ -57,6 +57,7 @@ describe 'Issues > User uses quick actions', :js do
end
end
it_behaves_like
'confidential quick action'
it_behaves_like
'confidential quick action'
it_behaves_like
'remove_due_date quick action'
describe
'adding a due date from note'
do
describe
'adding a due date from note'
do
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
...
@@ -76,24 +77,6 @@ describe 'Issues > User uses quick actions', :js do
...
@@ -76,24 +77,6 @@ describe 'Issues > User uses quick actions', :js do
end
end
end
end
describe
'removing a due date from note'
do
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
due_date:
Date
.
new
(
2016
,
8
,
28
))
}
it_behaves_like
'remove_due_date action available and due date can be removed'
context
'when the current user cannot update the due date'
do
let
(
:guest
)
{
create
(
:user
)
}
before
do
project
.
add_guest
(
guest
)
gitlab_sign_out
sign_in
(
guest
)
visit
project_issue_path
(
project
,
issue
)
end
it_behaves_like
'remove_due_date action not available'
end
end
describe
'toggling the WIP prefix from the title from note'
do
describe
'toggling the WIP prefix from the title from note'
do
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
...
...
spec/features/merge_request/user_uses_quick_actions_spec.rb
View file @
3a10bfdb
...
@@ -57,6 +57,7 @@ describe 'Merge request > User uses quick actions', :js do
...
@@ -57,6 +57,7 @@ describe 'Merge request > User uses quick actions', :js do
end
end
it_behaves_like
'merge quick action'
it_behaves_like
'merge quick action'
it_behaves_like
'target_branch quick action'
describe
'toggling the WIP prefix in the title from note'
do
describe
'toggling the WIP prefix in the title from note'
do
context
'when the current user can toggle the WIP prefix'
do
context
'when the current user can toggle the WIP prefix'
do
...
@@ -104,83 +105,5 @@ describe 'Merge request > User uses quick actions', :js do
...
@@ -104,83 +105,5 @@ describe 'Merge request > User uses quick actions', :js do
end
end
end
end
end
end
describe
'/target_branch command in merge request'
do
let
(
:another_project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:new_url_opts
)
{
{
merge_request:
{
source_branch:
'feature'
}
}
}
before
do
another_project
.
add_maintainer
(
user
)
sign_in
(
user
)
end
it
'changes target_branch in new merge_request'
do
visit
project_new_merge_request_path
(
another_project
,
new_url_opts
)
fill_in
"merge_request_title"
,
with:
'My brand new feature'
fill_in
"merge_request_description"
,
with:
"le feature
\n
/target_branch fix
\n
Feature description:"
click_button
"Submit merge request"
merge_request
=
another_project
.
merge_requests
.
first
expect
(
merge_request
.
description
).
to
eq
"le feature
\n
Feature description:"
expect
(
merge_request
.
target_branch
).
to
eq
'fix'
end
it
'does not change target branch when merge request is edited'
do
new_merge_request
=
create
(
:merge_request
,
source_project:
another_project
)
visit
edit_project_merge_request_path
(
another_project
,
new_merge_request
)
fill_in
"merge_request_description"
,
with:
"Want to update target branch
\n
/target_branch fix
\n
"
click_button
"Save changes"
new_merge_request
=
another_project
.
merge_requests
.
first
expect
(
new_merge_request
.
description
).
to
include
(
'/target_branch'
)
expect
(
new_merge_request
.
target_branch
).
not_to
eq
(
'fix'
)
end
end
describe
'/target_branch command from note'
do
context
'when the current user can change target branch'
do
before
do
sign_in
(
user
)
visit
project_merge_request_path
(
project
,
merge_request
)
end
it
'changes target branch from a note'
do
add_note
(
"message start
\n
/target_branch merge-test
\n
message end."
)
wait_for_requests
expect
(
page
).
not_to
have_content
(
'/target_branch'
)
expect
(
page
).
to
have_content
(
'message start'
)
expect
(
page
).
to
have_content
(
'message end.'
)
expect
(
merge_request
.
reload
.
target_branch
).
to
eq
'merge-test'
end
it
'does not fail when target branch does not exists'
do
add_note
(
'/target_branch totally_not_existing_branch'
)
expect
(
page
).
not_to
have_content
(
'/target_branch'
)
expect
(
merge_request
.
target_branch
).
to
eq
'feature'
end
end
context
'when current user can not change target branch'
do
before
do
project
.
add_guest
(
guest
)
sign_in
(
guest
)
visit
project_merge_request_path
(
project
,
merge_request
)
end
it
'does not change target branch'
do
add_note
(
'/target_branch merge-test'
)
expect
(
page
).
not_to
have_content
'/target_branch merge-test'
expect
(
merge_request
.
target_branch
).
to
eq
'feature'
end
end
end
end
end
end
end
spec/fixtures/blockquote_fence_after.md
View file @
3a10bfdb
...
@@ -18,10 +18,13 @@ Double `>>>` inside code block:
...
@@ -18,10 +18,13 @@ Double `>>>` inside code block:
Blockquote outside code block:
Blockquote outside code block:
> Quote
> Quote
Code block inside blockquote:
Code block inside blockquote:
> Quote
> Quote
>
>
> ```
> ```
...
@@ -30,8 +33,10 @@ Code block inside blockquote:
...
@@ -30,8 +33,10 @@ Code block inside blockquote:
>
>
> Quote
> Quote
Single
`>>>`
inside code block inside blockquote:
Single
`>>>`
inside code block inside blockquote:
> Quote
> Quote
>
>
> ```
> ```
...
@@ -42,8 +47,10 @@ Single `>>>` inside code block inside blockquote:
...
@@ -42,8 +47,10 @@ Single `>>>` inside code block inside blockquote:
>
>
> Quote
> Quote
Double
`>>>`
inside code block inside blockquote:
Double
`>>>`
inside code block inside blockquote:
> Quote
> Quote
>
>
> ```
> ```
...
@@ -56,6 +63,7 @@ Double `>>>` inside code block inside blockquote:
...
@@ -56,6 +63,7 @@ Double `>>>` inside code block inside blockquote:
>
>
> Quote
> Quote
Single
`>>>`
inside HTML:
Single
`>>>`
inside HTML:
<pre>
<pre>
...
@@ -76,10 +84,13 @@ Double `>>>` inside HTML:
...
@@ -76,10 +84,13 @@ Double `>>>` inside HTML:
Blockquote outside HTML:
Blockquote outside HTML:
> Quote
> Quote
HTML inside blockquote:
HTML inside blockquote:
> Quote
> Quote
>
>
> <pre>
> <pre>
...
@@ -88,8 +99,10 @@ HTML inside blockquote:
...
@@ -88,8 +99,10 @@ HTML inside blockquote:
>
>
> Quote
> Quote
Single
`>>>`
inside HTML inside blockquote:
Single
`>>>`
inside HTML inside blockquote:
> Quote
> Quote
>
>
> <pre>
> <pre>
...
@@ -100,8 +113,10 @@ Single `>>>` inside HTML inside blockquote:
...
@@ -100,8 +113,10 @@ Single `>>>` inside HTML inside blockquote:
>
>
> Quote
> Quote
Double
`>>>`
inside HTML inside blockquote:
Double
`>>>`
inside HTML inside blockquote:
> Quote
> Quote
>
>
> <pre>
> <pre>
...
@@ -113,3 +128,4 @@ Double `>>>` inside HTML inside blockquote:
...
@@ -113,3 +128,4 @@ Double `>>>` inside HTML inside blockquote:
> </pre>
> </pre>
>
>
> Quote
> Quote
spec/frontend/helpers/monitor_helper_spec.js
0 → 100644
View file @
3a10bfdb
import
*
as
monitorHelper
from
'
~/helpers/monitor_helper
'
;
describe
(
'
monitor helper
'
,
()
=>
{
const
defaultConfig
=
{
default
:
true
,
name
:
'
default name
'
};
const
name
=
'
data name
'
;
const
series
=
[[
1
,
1
],
[
2
,
2
],
[
3
,
3
]];
const
data
=
({
metric
=
{
default_name
:
name
},
values
=
series
}
=
{})
=>
[{
metric
,
values
}];
describe
(
'
makeDataSeries
'
,
()
=>
{
const
expectedDataSeries
=
[
{
...
defaultConfig
,
data
:
series
,
},
];
it
(
'
converts query results to data series
'
,
()
=>
{
expect
(
monitorHelper
.
makeDataSeries
(
data
({
metric
:
{}
}),
defaultConfig
)).
toEqual
(
expectedDataSeries
,
);
});
it
(
'
returns an empty array if no query results exist
'
,
()
=>
{
expect
(
monitorHelper
.
makeDataSeries
([],
defaultConfig
)).
toEqual
([]);
});
it
(
'
handles multi-series query results
'
,
()
=>
{
const
expectedData
=
{
...
expectedDataSeries
[
0
],
name
:
'
default name: data name
'
};
expect
(
monitorHelper
.
makeDataSeries
([...
data
(),
...
data
()],
defaultConfig
)).
toEqual
([
expectedData
,
expectedData
,
]);
});
it
(
'
excludes NaN values
'
,
()
=>
{
expect
(
monitorHelper
.
makeDataSeries
(
data
({
metric
:
{},
values
:
[[
1
,
1
],
[
2
,
NaN
]]
}),
defaultConfig
,
),
).
toEqual
([{
...
expectedDataSeries
[
0
],
data
:
[[
1
,
1
]]
}]);
});
});
});
spec/lib/banzai/filter/blockquote_fence_filter_spec.rb
View file @
3a10bfdb
...
@@ -13,6 +13,6 @@ describe Banzai::Filter::BlockquoteFenceFilter do
...
@@ -13,6 +13,6 @@ describe Banzai::Filter::BlockquoteFenceFilter do
end
end
it
'allows trailing whitespace on blockquote fence lines'
do
it
'allows trailing whitespace on blockquote fence lines'
do
expect
(
filter
(
">>>
\n
test
\n
>>> "
)).
to
eq
(
"
> test
"
)
expect
(
filter
(
">>>
\n
test
\n
>>> "
)).
to
eq
(
"
\n
> test
\n
"
)
end
end
end
end
spec/services/issues/build_service_spec.rb
View file @
3a10bfdb
...
@@ -58,8 +58,10 @@ describe Issues::BuildService do
...
@@ -58,8 +58,10 @@ describe Issues::BuildService do
"> That has a quote
\n
"
\
"> That has a quote
\n
"
\
">>>
\n
"
">>>
\n
"
note_result
=
" > This is a string
\n
"
\
note_result
=
" > This is a string
\n
"
\
" >
\n
"
\
" > > with a blockquote
\n
"
\
" > > with a blockquote
\n
"
\
" > > > That has a quote
\n
"
" > > > That has a quote
\n
"
\
" >
\n
"
discussion
=
create
(
:diff_note_on_merge_request
,
note:
note_text
).
to_discussion
discussion
=
create
(
:diff_note_on_merge_request
,
note:
note_text
).
to_discussion
expect
(
service
.
item_for_discussion
(
discussion
)).
to
include
(
note_result
)
expect
(
service
.
item_for_discussion
(
discussion
)).
to
include
(
note_result
)
end
end
...
...
spec/services/task_list_toggle_service_spec.rb
View file @
3a10bfdb
...
@@ -113,4 +113,25 @@ describe TaskListToggleService do
...
@@ -113,4 +113,25 @@ describe TaskListToggleService do
expect
(
toggler
.
execute
).
to
be_falsey
expect
(
toggler
.
execute
).
to
be_falsey
end
end
it
'properly handles a GitLab blockquote'
do
markdown
=
<<-
EOT
.
strip_heredoc
>>>
gitlab blockquote
>>>
* [ ] Task 1
* [x] Task 2
EOT
markdown_html
=
Banzai
::
Pipeline
::
FullPipeline
.
call
(
markdown
,
project:
nil
)[
:output
].
to_html
toggler
=
described_class
.
new
(
markdown
,
markdown_html
,
toggle_as_checked:
true
,
line_source:
'* [ ] Task 1'
,
line_number:
5
)
expect
(
toggler
.
execute
).
to
be_truthy
expect
(
toggler
.
updated_markdown
.
lines
[
4
]).
to
eq
"* [x] Task 1
\n
"
expect
(
toggler
.
updated_markdown_html
).
to
include
(
'disabled checked> Task 1'
)
end
end
end
spec/support/shared_examples/quick_actions/issue/remove_due_date_quick_action_shared_examples.rb
View file @
3a10bfdb
# frozen_string_literal: true
# frozen_string_literal: true
shared_examples
'remove_due_date action not available'
do
shared_examples
'remove_due_date quick action'
do
it
'does not remove the due date'
do
context
'remove_due_date action available and due date can be removed'
do
add_note
(
"/remove_due_date"
)
it
'removes the due date accordingly'
do
add_note
(
'/remove_due_date'
)
expect
(
page
).
not_to
have_content
'Commands applied
'
expect
(
page
).
not_to
have_content
'/remove_due_date
'
expect
(
page
).
not_to
have_content
'/remove_due_date
'
expect
(
page
).
to
have_content
'Commands applied
'
end
end
visit
project_issue_path
(
project
,
issue
)
shared_examples
'remove_due_date action available and due date can be removed'
do
page
.
within
'.due_date'
do
it
'removes the due date accordingly'
do
expect
(
page
).
to
have_content
'No due date'
add_note
(
'/remove_due_date'
)
end
end
end
expect
(
page
).
not_to
have_content
'/remove_due_date'
context
'remove_due_date action not available'
do
expect
(
page
).
to
have_content
'Commands applied'
let
(
:guest
)
{
create
(
:user
)
}
before
do
project
.
add_guest
(
guest
)
gitlab_sign_out
sign_in
(
guest
)
visit
project_issue_path
(
project
,
issue
)
end
visit
project_issue_path
(
project
,
issue
)
it
'does not remove the due date'
do
add_note
(
"/remove_due_date"
)
page
.
within
'.due_date'
do
expect
(
page
).
not_to
have_content
'Commands applied'
expect
(
page
).
to
have_content
'No due
date'
expect
(
page
).
not_to
have_content
'/remove_due_
date'
end
end
end
end
end
end
spec/support/shared_examples/quick_actions/merge_request/target_branch_quick_action_shared_examples.rb
View file @
3a10bfdb
# frozen_string_literal: true
# frozen_string_literal: true
shared_examples
'target_branch quick action'
do
shared_examples
'target_branch quick action'
do
describe
'/target_branch command in merge request'
do
let
(
:another_project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:new_url_opts
)
{
{
merge_request:
{
source_branch:
'feature'
}
}
}
before
do
another_project
.
add_maintainer
(
user
)
sign_in
(
user
)
end
it
'changes target_branch in new merge_request'
do
visit
project_new_merge_request_path
(
another_project
,
new_url_opts
)
fill_in
"merge_request_title"
,
with:
'My brand new feature'
fill_in
"merge_request_description"
,
with:
"le feature
\n
/target_branch fix
\n
Feature description:"
click_button
"Submit merge request"
merge_request
=
another_project
.
merge_requests
.
first
expect
(
merge_request
.
description
).
to
eq
"le feature
\n
Feature description:"
expect
(
merge_request
.
target_branch
).
to
eq
'fix'
end
it
'does not change target branch when merge request is edited'
do
new_merge_request
=
create
(
:merge_request
,
source_project:
another_project
)
visit
edit_project_merge_request_path
(
another_project
,
new_merge_request
)
fill_in
"merge_request_description"
,
with:
"Want to update target branch
\n
/target_branch fix
\n
"
click_button
"Save changes"
new_merge_request
=
another_project
.
merge_requests
.
first
expect
(
new_merge_request
.
description
).
to
include
(
'/target_branch'
)
expect
(
new_merge_request
.
target_branch
).
not_to
eq
(
'fix'
)
end
end
describe
'/target_branch command from note'
do
context
'when the current user can change target branch'
do
before
do
sign_in
(
user
)
visit
project_merge_request_path
(
project
,
merge_request
)
end
it
'changes target branch from a note'
do
add_note
(
"message start
\n
/target_branch merge-test
\n
message end."
)
wait_for_requests
expect
(
page
).
not_to
have_content
(
'/target_branch'
)
expect
(
page
).
to
have_content
(
'message start'
)
expect
(
page
).
to
have_content
(
'message end.'
)
expect
(
merge_request
.
reload
.
target_branch
).
to
eq
'merge-test'
end
it
'does not fail when target branch does not exists'
do
add_note
(
'/target_branch totally_not_existing_branch'
)
expect
(
page
).
not_to
have_content
(
'/target_branch'
)
expect
(
merge_request
.
target_branch
).
to
eq
'feature'
end
end
context
'when current user can not change target branch'
do
before
do
project
.
add_guest
(
guest
)
sign_in
(
guest
)
visit
project_merge_request_path
(
project
,
merge_request
)
end
it
'does not change target branch'
do
add_note
(
'/target_branch merge-test'
)
expect
(
page
).
not_to
have_content
'/target_branch merge-test'
expect
(
merge_request
.
target_branch
).
to
eq
'feature'
end
end
end
end
end
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