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
Boxiang Sun
gitlab-ce
Commits
1c0588e7
Commit
1c0588e7
authored
Mar 25, 2019
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve CE/EE differences in MergeRequestPresenter spec
parent
4e045cd5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
2 deletions
+44
-2
spec/presenters/merge_request_presenter_spec.rb
spec/presenters/merge_request_presenter_spec.rb
+44
-2
No files found.
spec/presenters/merge_request_presenter_spec.rb
View file @
1c0588e7
require
'spec_helper'
require
'spec_helper'
describe
MergeRequestPresenter
do
describe
MergeRequestPresenter
do
let
(
:resource
)
{
create
:merge_request
,
source_project:
project
}
let
(
:resource
)
{
create
(
:merge_request
,
source_project:
project
)
}
let
(
:project
)
{
create
:project
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
describe
'#ci_status'
do
describe
'#ci_status'
do
...
@@ -523,4 +523,46 @@ describe MergeRequestPresenter do
...
@@ -523,4 +523,46 @@ describe MergeRequestPresenter do
end
end
end
end
end
end
describe
'#can_push_to_source_branch'
do
before
do
allow
(
resource
).
to
receive
(
:source_branch_exists?
)
{
source_branch_exists
}
allow_any_instance_of
(
Gitlab
::
UserAccess
::
RequestCacheExtension
)
.
to
receive
(
:can_push_to_branch?
)
.
with
(
resource
.
source_branch
)
.
and_return
(
can_push_to_branch
)
end
subject
do
described_class
.
new
(
resource
,
current_user:
user
).
can_push_to_source_branch?
end
context
'when source branch exists AND user can push to source branch'
do
let
(
:source_branch_exists
)
{
true
}
let
(
:can_push_to_branch
)
{
true
}
it
'returns true'
do
is_expected
.
to
eq
(
true
)
end
end
context
'when source branch does not exists'
do
let
(
:source_branch_exists
)
{
false
}
let
(
:can_push_to_branch
)
{
true
}
it
'returns false'
do
is_expected
.
to
eq
(
false
)
end
end
context
'when user cannot push to source branch'
do
let
(
:source_branch_exists
)
{
true
}
let
(
:can_push_to_branch
)
{
false
}
it
'returns false'
do
is_expected
.
to
eq
(
false
)
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