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
84b49c70
Commit
84b49c70
authored
Jan 14, 2019
by
Mark Chao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix spec by testing only old case for now
Logic unchanged
parent
2b40c12c
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
32 additions
and
1 deletion
+32
-1
ee/spec/controllers/projects/merge_requests_controller_spec.rb
...ec/controllers/projects/merge_requests_controller_spec.rb
+1
-0
ee/spec/features/merge_request/user_approves_spec.rb
ee/spec/features/merge_request/user_approves_spec.rb
+1
-0
ee/spec/features/merge_request/user_sets_approvers_spec.rb
ee/spec/features/merge_request/user_sets_approvers_spec.rb
+2
-0
ee/spec/features/projects/merge_requests/user_approves_merge_request_spec.rb
...ojects/merge_requests/user_approves_merge_request_spec.rb
+3
-0
ee/spec/presenters/merge_request_presenter_spec.rb
ee/spec/presenters/merge_request_presenter_spec.rb
+5
-0
ee/spec/requests/api/merge_request_approvals_spec.rb
ee/spec/requests/api/merge_request_approvals_spec.rb
+2
-0
ee/spec/requests/api/project_approvals_spec.rb
ee/spec/requests/api/project_approvals_spec.rb
+4
-0
ee/spec/services/ee/merge_requests/refresh_service_spec.rb
ee/spec/services/ee/merge_requests/refresh_service_spec.rb
+3
-1
ee/spec/services/merge_requests/remove_approval_service_spec.rb
...c/services/merge_requests/remove_approval_service_spec.rb
+4
-0
ee/spec/services/projects/update_service_spec.rb
ee/spec/services/projects/update_service_spec.rb
+2
-0
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+2
-0
spec/services/merge_requests/update_service_spec.rb
spec/services/merge_requests/update_service_spec.rb
+2
-0
spec/services/notification_service_spec.rb
spec/services/notification_service_spec.rb
+1
-0
No files found.
ee/spec/controllers/projects/merge_requests_controller_spec.rb
View file @
84b49c70
...
@@ -100,6 +100,7 @@ describe Projects::MergeRequestsController do
...
@@ -100,6 +100,7 @@ describe Projects::MergeRequestsController do
let
(
:viewer
)
{
user
}
let
(
:viewer
)
{
user
}
before
do
before
do
stub_feature_flags
(
approval_rule:
false
)
sign_in
(
viewer
)
sign_in
(
viewer
)
end
end
...
...
ee/spec/features/merge_request/user_approves_spec.rb
View file @
84b49c70
...
@@ -61,6 +61,7 @@ describe 'Merge request > User approves', :js do
...
@@ -61,6 +61,7 @@ describe 'Merge request > User approves', :js do
context
'when CI is running but no approval given'
do
context
'when CI is running but no approval given'
do
before
do
before
do
stub_feature_flags
(
approval_rule:
false
)
# TODO check in !9001 when feature enabled
create
:approver_group
,
group:
group
,
target:
merge_request
create
:approver_group
,
group:
group
,
target:
merge_request
pipeline
=
create
(
:ci_empty_pipeline
,
project:
project
,
sha:
merge_request
.
diff_head_sha
,
ref:
merge_request
.
source_branch
)
pipeline
=
create
(
:ci_empty_pipeline
,
project:
project
,
sha:
merge_request
.
diff_head_sha
,
ref:
merge_request
.
source_branch
)
merge_request
.
update
(
head_pipeline:
pipeline
)
merge_request
.
update
(
head_pipeline:
pipeline
)
...
...
ee/spec/features/merge_request/user_sets_approvers_spec.rb
View file @
84b49c70
...
@@ -53,6 +53,7 @@ describe 'Merge request > User sets approvers', :js do
...
@@ -53,6 +53,7 @@ describe 'Merge request > User sets approvers', :js do
let
(
:other_user
)
{
create
(
:user
)
}
let
(
:other_user
)
{
create
(
:user
)
}
before
do
before
do
stub_feature_flags
(
approval_rule:
false
)
# TODO check in !9001 when feature enabled
project
.
add_developer
(
user
)
project
.
add_developer
(
user
)
project
.
add_developer
(
other_user
)
project
.
add_developer
(
other_user
)
...
@@ -108,6 +109,7 @@ describe 'Merge request > User sets approvers', :js do
...
@@ -108,6 +109,7 @@ describe 'Merge request > User sets approvers', :js do
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
)
}
before
do
before
do
stub_feature_flags
(
approval_rule:
false
)
# TODO check in !9001 when feature enabled
project
.
add_developer
(
user
)
project
.
add_developer
(
user
)
sign_in
(
user
)
sign_in
(
user
)
...
...
ee/spec/features/projects/merge_requests/user_approves_merge_request_spec.rb
View file @
84b49c70
...
@@ -14,6 +14,7 @@ describe 'User approves a merge request', :js do
...
@@ -14,6 +14,7 @@ describe 'User approves a merge request', :js do
context
'when user can approve'
do
context
'when user can approve'
do
before
do
before
do
stub_feature_flags
(
approval_rule:
false
)
# TODO check in !9001 when feature enabled
visit
(
merge_request_path
(
merge_request
))
visit
(
merge_request_path
(
merge_request
))
end
end
...
@@ -30,6 +31,7 @@ describe 'User approves a merge request', :js do
...
@@ -30,6 +31,7 @@ describe 'User approves a merge request', :js do
context
'when a merge request is approved additionally'
do
context
'when a merge request is approved additionally'
do
before
do
before
do
stub_feature_flags
(
approval_rule:
false
)
# TODO check in !9001 when feature enabled
project
.
add_developer
(
user2
)
project
.
add_developer
(
user2
)
project
.
add_developer
(
user3
)
project
.
add_developer
(
user3
)
end
end
...
@@ -73,6 +75,7 @@ describe 'User approves a merge request', :js do
...
@@ -73,6 +75,7 @@ describe 'User approves a merge request', :js do
context
'when user cannot approve'
do
context
'when user cannot approve'
do
before
do
before
do
stub_feature_flags
(
approval_rule:
false
)
# TODO check in !9001 when feature enabled
merge_request
.
approvers
.
create
(
user_id:
user2
.
id
)
merge_request
.
approvers
.
create
(
user_id:
user2
.
id
)
visit
(
merge_request_path
(
merge_request
))
visit
(
merge_request_path
(
merge_request
))
...
...
ee/spec/presenters/merge_request_presenter_spec.rb
View file @
84b49c70
...
@@ -21,6 +21,7 @@ describe MergeRequestPresenter do
...
@@ -21,6 +21,7 @@ describe MergeRequestPresenter do
let!
(
:approver
)
{
create
(
:approver
,
target:
resource
)
}
let!
(
:approver
)
{
create
(
:approver
,
target:
resource
)
}
before
do
before
do
stub_feature_flags
(
approval_rule:
false
)
resource
.
approvals
.
create!
(
user:
approver
.
user
)
resource
.
approvals
.
create!
(
user:
approver
.
user
)
end
end
...
@@ -69,6 +70,10 @@ describe MergeRequestPresenter do
...
@@ -69,6 +70,10 @@ describe MergeRequestPresenter do
subject
{
described_class
.
new
(
resource
,
current_user:
user
).
all_approvers_including_groups
}
subject
{
described_class
.
new
(
resource
,
current_user:
user
).
all_approvers_including_groups
}
before
do
stub_feature_flags
(
approval_rule:
false
)
end
it
{
is_expected
.
to
match_array
(
public_approver_group
.
users
+
[
approver
.
user
])
}
it
{
is_expected
.
to
match_array
(
public_approver_group
.
users
+
[
approver
.
user
])
}
context
'when user has access to private group'
do
context
'when user has access to private group'
do
...
...
ee/spec/requests/api/merge_request_approvals_spec.rb
View file @
84b49c70
...
@@ -9,6 +9,8 @@ describe API::MergeRequestApprovals do
...
@@ -9,6 +9,8 @@ describe API::MergeRequestApprovals do
before
do
before
do
project
.
update_attribute
(
:approvals_before_merge
,
2
)
project
.
update_attribute
(
:approvals_before_merge
,
2
)
stub_feature_flags
(
approval_rule:
false
)
end
end
describe
'GET :id/merge_requests/:merge_request_iid/approvals'
do
describe
'GET :id/merge_requests/:merge_request_iid/approvals'
do
...
...
ee/spec/requests/api/project_approvals_spec.rb
View file @
84b49c70
...
@@ -10,6 +10,10 @@ describe API::ProjectApprovals do
...
@@ -10,6 +10,10 @@ describe API::ProjectApprovals do
let
(
:url
)
{
"/projects/
#{
project
.
id
}
/approvals"
}
let
(
:url
)
{
"/projects/
#{
project
.
id
}
/approvals"
}
before
do
stub_feature_flags
(
approval_rule:
false
)
end
describe
'GET /projects/:id/approvers'
do
describe
'GET /projects/:id/approvers'
do
context
'when the request is correct'
do
context
'when the request is correct'
do
before
do
before
do
...
...
ee/spec/services/ee/merge_requests/refresh_service_spec.rb
View file @
84b49c70
...
@@ -73,12 +73,14 @@ describe MergeRequests::RefreshService do
...
@@ -73,12 +73,14 @@ describe MergeRequests::RefreshService do
end
end
end
end
context
'when code owners enabled'
do
context
'when code owners enabled
, with approval_rule disabled
'
do
let
(
:old_owners
)
{
[]
}
let
(
:old_owners
)
{
[]
}
let
(
:new_owners
)
{
[]
}
let
(
:new_owners
)
{
[]
}
let
(
:relevant_merge_requests
)
{
[
merge_request
,
another_merge_request
]
}
let
(
:relevant_merge_requests
)
{
[
merge_request
,
another_merge_request
]
}
before
do
before
do
stub_feature_flags
(
approval_rule:
false
)
relevant_merge_requests
.
each
do
|
merge_request
|
relevant_merge_requests
.
each
do
|
merge_request
|
expect
(
::
Gitlab
::
CodeOwners
).
to
receive
(
:for_merge_request
).
with
(
merge_request
).
and_return
(
new_owners
)
expect
(
::
Gitlab
::
CodeOwners
).
to
receive
(
:for_merge_request
).
with
(
merge_request
).
and_return
(
new_owners
)
expect
(
::
Gitlab
::
CodeOwners
).
to
receive
(
:for_merge_request
).
with
(
merge_request
,
merge_request_diff:
anything
).
and_wrap_original
do
|
m
,
*
args
|
expect
(
::
Gitlab
::
CodeOwners
).
to
receive
(
:for_merge_request
).
with
(
merge_request
,
merge_request_diff:
anything
).
and_wrap_original
do
|
m
,
*
args
|
...
...
ee/spec/services/merge_requests/remove_approval_service_spec.rb
View file @
84b49c70
...
@@ -8,6 +8,10 @@ describe MergeRequests::RemoveApprovalService do
...
@@ -8,6 +8,10 @@ describe MergeRequests::RemoveApprovalService do
subject
(
:service
)
{
described_class
.
new
(
project
,
user
)
}
subject
(
:service
)
{
described_class
.
new
(
project
,
user
)
}
before
do
stub_feature_flags
(
approval_rule:
false
)
end
def
execute!
def
execute!
service
.
execute
(
merge_request
)
service
.
execute
(
merge_request
)
end
end
...
...
ee/spec/services/projects/update_service_spec.rb
View file @
84b49c70
...
@@ -231,6 +231,8 @@ describe Projects::UpdateService, '#execute' do
...
@@ -231,6 +231,8 @@ describe Projects::UpdateService, '#execute' do
context
'with approval_rules'
do
context
'with approval_rules'
do
it
"updates approval_rules' approvals_required"
do
it
"updates approval_rules' approvals_required"
do
stub_feature_flags
(
approval_rule:
false
)
rule
=
create
(
:approval_project_rule
,
project:
project
)
rule
=
create
(
:approval_project_rule
,
project:
project
)
update_project
(
project
,
user
,
approvals_before_merge:
42
)
update_project
(
project
,
user
,
approvals_before_merge:
42
)
...
...
spec/models/merge_request_spec.rb
View file @
84b49c70
...
@@ -2442,6 +2442,8 @@ describe MergeRequest do
...
@@ -2442,6 +2442,8 @@ describe MergeRequest do
let
(
:stranger
)
{
create
(
:user
)
}
let
(
:stranger
)
{
create
(
:user
)
}
before
do
before
do
stub_feature_flags
(
approval_rule:
false
)
project
.
add_developer
(
author
)
project
.
add_developer
(
author
)
project
.
add_developer
(
approver
)
project
.
add_developer
(
approver
)
project
.
add_developer
(
approver_2
)
project
.
add_developer
(
approver_2
)
...
...
spec/services/merge_requests/update_service_spec.rb
View file @
84b49c70
...
@@ -19,6 +19,8 @@ describe MergeRequests::UpdateService, :mailer do
...
@@ -19,6 +19,8 @@ describe MergeRequests::UpdateService, :mailer do
end
end
before
do
before
do
stub_feature_flags
(
approval_rule:
false
)
project
.
add_maintainer
(
user
)
project
.
add_maintainer
(
user
)
project
.
add_developer
(
user2
)
project
.
add_developer
(
user2
)
project
.
add_developer
(
user3
)
project
.
add_developer
(
user3
)
...
...
spec/services/notification_service_spec.rb
View file @
84b49c70
...
@@ -1308,6 +1308,7 @@ describe NotificationService, :mailer do
...
@@ -1308,6 +1308,7 @@ describe NotificationService, :mailer do
let
(
:project_approvers
)
{
create_list
(
:user
,
3
)
}
let
(
:project_approvers
)
{
create_list
(
:user
,
3
)
}
before
do
before
do
stub_feature_flags
(
approval_rule:
false
)
merge_request
.
target_project
.
update
(
approvals_before_merge:
1
)
merge_request
.
target_project
.
update
(
approvals_before_merge:
1
)
project_approvers
.
each
{
|
approver
|
create
(
:approver
,
user:
approver
,
target:
merge_request
.
target_project
)
}
project_approvers
.
each
{
|
approver
|
create
(
:approver
,
user:
approver
,
target:
merge_request
.
target_project
)
}
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