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
78f221d1
Commit
78f221d1
authored
Nov 28, 2016
by
Gabriel Gizotti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
describe #closes_issues and describe # #issues_mentioned_but_not_closing on merge_request_spec.rb
parent
d1980ef9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
24 deletions
+14
-24
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+14
-24
No files found.
spec/models/merge_request_spec.rb
View file @
78f221d1
...
...
@@ -252,7 +252,7 @@ describe MergeRequest, models: true do
end
end
describe
'
detection of
issues'
do
describe
'
#closes_
issues'
do
let
(
:issue0
)
{
create
:issue
,
project:
subject
.
project
}
let
(
:issue1
)
{
create
:issue
,
project:
subject
.
project
}
...
...
@@ -265,38 +265,28 @@ describe MergeRequest, models: true do
allow
(
subject
).
to
receive
(
:commits
).
and_return
([
commit0
,
commit1
,
commit2
])
end
describe
'detection of issues to be closed'
do
it
'accesses the set of issues that will be closed on acceptance'
do
allow
(
subject
.
project
).
to
receive
(
:default_branch
).
and_return
(
subject
.
target_branch
)
closed
=
subject
.
closes_issues
expect
(
closed
).
to
include
(
issue0
,
issue1
)
end
it
'only lists issues as to be closed if it targets the default branch'
do
allow
(
subject
.
project
).
to
receive
(
:default_branch
).
and_return
(
'master'
)
subject
.
target_branch
=
'something-else'
expect
(
subject
.
closes_issues
).
to
be_empty
end
it
'accesses the set of issues that will be closed on acceptance'
do
allow
(
subject
.
project
).
to
receive
(
:default_branch
).
and_return
(
subject
.
target_branch
)
it
'detects issues mentioned in the description'
do
issue2
=
create
(
:issue
,
project:
subject
.
project
)
closed
=
subject
.
closes_issues
subject
.
description
=
"Closes
#{
issue2
.
to_reference
}
"
expect
(
closed
).
to
include
(
issue0
,
issue1
)
end
allow
(
subject
.
project
).
to
receive
(
:default_branch
).
and_return
(
subject
.
target_branch
)
it
'only lists issues as to be closed if it targets the default branch'
do
allow
(
subject
.
project
).
to
receive
(
:default_branch
).
and_return
(
'master'
)
subject
.
target_branch
=
'something-else'
expect
(
subject
.
closes_issues
).
to
include
(
issue2
)
end
expect
(
subject
.
closes_issues
).
to
be_empty
end
end
describe
'#issues_mentioned_but_not_closing'
do
it
'detects issues mentioned in description but not closed'
do
mentioned_issue
=
create
(
:issue
,
project:
subject
.
project
)
subject
.
project
.
team
<<
[
subject
.
author
,
:developer
]
subject
.
description
=
"Is related to
#{
mentioned_issue
.
to_reference
}
"
allow
(
subject
.
project
).
to
receive
(
:default_branch
).
...
...
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