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
0
Merge Requests
0
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
Tatuya Kamada
gitlab-ce
Commits
821ab7cf
Commit
821ab7cf
authored
Jan 25, 2017
by
Dongqing Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests for #mr_closes_issues and #mr_issues_mentioned_but_not_closing in MergeRequestsHelper
parent
da81add8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
0 deletions
+86
-0
changelogs/unreleased/pass in current_user in MergeRequest and MergeRequestsHelper.yml
... current_user in MergeRequest and MergeRequestsHelper.yml
+4
-0
spec/helpers/merge_requests_helper_spec.rb
spec/helpers/merge_requests_helper_spec.rb
+82
-0
No files found.
changelogs/unreleased/pass in current_user in MergeRequest and MergeRequestsHelper.yml
0 → 100644
View file @
821ab7cf
---
title
:
pass in current_user in MergeRequest and MergeRequestsHelper
merge_request
:
8624
author
:
Dongqing Hu
spec/helpers/merge_requests_helper_spec.rb
View file @
821ab7cf
...
@@ -77,4 +77,86 @@ describe MergeRequestsHelper do
...
@@ -77,4 +77,86 @@ describe MergeRequestsHelper do
expect
(
mr_widget_refresh_url
(
nil
)).
to
end_with
(
''
)
expect
(
mr_widget_refresh_url
(
nil
)).
to
end_with
(
''
)
end
end
end
end
describe
'#mr_closes_issues'
do
let
(
:user_1
)
{
create
(
:user
)
}
let
(
:user_2
)
{
create
(
:user
)
}
let
(
:project_1
)
{
create
(
:project
,
:private
,
creator:
user_1
,
namespace:
user_1
.
namespace
)
}
let
(
:project_2
)
{
create
(
:project
,
:private
,
creator:
user_2
,
namespace:
user_2
.
namespace
)
}
let
(
:issue_1
)
{
create
(
:issue
,
project:
project_1
)
}
let
(
:issue_2
)
{
create
(
:issue
,
project:
project_2
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project_1
,
target_project:
project_1
,)
}
let
(
:merge_request
)
do
create
(
:merge_request
,
source_project:
project_1
,
target_project:
project_1
,
description:
"Fixes
#{
issue_1
.
to_reference
}
Fixes
#{
issue_2
.
to_reference
(
project_1
)
}
"
)
end
before
do
project_1
.
team
<<
[
user_2
,
:developer
]
project_2
.
team
<<
[
user_2
,
:developer
]
allow
(
merge_request
.
project
).
to
receive
(
:default_branch
).
and_return
(
merge_request
.
target_branch
)
@merge_request
=
merge_request
end
context
'user without access to another private project'
do
let
(
:current_user
)
{
user_1
}
it
'cannot see that project\'s issue that will be closed on acceptance'
do
expect
(
mr_closes_issues
).
to
contain_exactly
(
issue_1
)
end
end
context
'user with access to another private project'
do
let
(
:current_user
)
{
user_2
}
it
'can see that project\'s issue that will be closed on acceptance'
do
expect
(
mr_closes_issues
).
to
contain_exactly
(
issue_1
,
issue_2
)
end
end
end
describe
'#mr_issues_mentioned_but_not_closing'
do
let
(
:user_1
)
{
create
(
:user
)
}
let
(
:user_2
)
{
create
(
:user
)
}
let
(
:project_1
)
{
create
(
:project
,
:private
,
creator:
user_1
,
namespace:
user_1
.
namespace
)
}
let
(
:project_2
)
{
create
(
:project
,
:private
,
creator:
user_2
,
namespace:
user_2
.
namespace
)
}
let
(
:issue_1
)
{
create
(
:issue
,
project:
project_1
)
}
let
(
:issue_2
)
{
create
(
:issue
,
project:
project_2
)
}
let
(
:merge_request
)
do
create
(
:merge_request
,
source_project:
project_1
,
target_project:
project_1
,
description:
"
#{
issue_1
.
to_reference
}
#{
issue_2
.
to_reference
(
project_1
)
}
"
)
end
before
do
project_1
.
team
<<
[
user_2
,
:developer
]
project_2
.
team
<<
[
user_2
,
:developer
]
allow
(
merge_request
.
project
).
to
receive
(
:default_branch
).
and_return
(
merge_request
.
target_branch
)
@merge_request
=
merge_request
end
context
'user without access to another private project'
do
let
(
:current_user
)
{
user_1
}
it
'cannot see that project\'s issue that will be closed on acceptance'
do
expect
(
mr_issues_mentioned_but_not_closing
).
to
contain_exactly
(
issue_1
)
end
end
context
'user with access to another private project'
do
let
(
:current_user
)
{
user_2
}
it
'can see that project\'s issue that will be closed on acceptance'
do
expect
(
mr_issues_mentioned_but_not_closing
).
to
contain_exactly
(
issue_1
,
issue_2
)
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