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
356bfe4e
Commit
356bfe4e
authored
Mar 08, 2017
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Speed up MergeRequest::RefreshService spec by combining examples
parent
d04a47c4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
59 deletions
+75
-59
spec/services/merge_requests/refresh_service_spec.rb
spec/services/merge_requests/refresh_service_spec.rb
+75
-59
No files found.
spec/services/merge_requests/refresh_service_spec.rb
View file @
356bfe4e
...
@@ -66,18 +66,19 @@ describe MergeRequests::RefreshService, services: true do
...
@@ -66,18 +66,19 @@ describe MergeRequests::RefreshService, services: true do
it
'executes hooks with update action'
do
it
'executes hooks with update action'
do
expect
(
refresh_service
).
to
have_received
(
:execute_hooks
).
expect
(
refresh_service
).
to
have_received
(
:execute_hooks
).
with
(
@merge_request
,
'update'
,
@oldrev
)
with
(
@merge_request
,
'update'
,
@oldrev
)
end
it
{
expect
(
@merge_request
.
notes
).
not_to
be_empty
}
expect
(
@merge_request
.
notes
).
not_to
be_empty
it
{
expect
(
@merge_request
).
to
be_open
}
expect
(
@merge_request
).
to
be_open
it
{
expect
(
@merge_request
.
approvals
).
to
be_empty
}
expect
(
@merge_request
.
merge_when_pipeline_succeeds
).
to
be_falsey
it
{
expect
(
@merge_request
.
merge_when_pipeline_succeeds
).
to
be_falsey
}
expect
(
@merge_request
.
diff_head_sha
).
to
eq
(
@newrev
)
it
{
expect
(
@merge_request
.
diff_head_sha
).
to
eq
(
@newrev
)
}
expect
(
@fork_merge_request
).
to
be_open
it
{
expect
(
@fork_merge_request
).
to
be_open
}
expect
(
@fork_merge_request
.
notes
).
to
be_empty
it
{
expect
(
@fork_merge_request
.
notes
).
to
be_empty
}
expect
(
@build_failed_todo
).
to
be_done
it
{
expect
(
@build_failed_todo
).
to
be_done
}
expect
(
@fork_build_failed_todo
).
to
be_done
it
{
expect
(
@fork_build_failed_todo
).
to
be_done
}
# EE-only
it
{
expect
(
@fork_merge_request
.
approvals
).
not_to
be_empty
}
expect
(
@merge_request
.
approvals
).
to
be_empty
expect
(
@fork_merge_request
.
approvals
).
not_to
be_empty
end
end
end
context
'push to origin repo target branch'
do
context
'push to origin repo target branch'
do
...
@@ -86,14 +87,17 @@ describe MergeRequests::RefreshService, services: true do
...
@@ -86,14 +87,17 @@ describe MergeRequests::RefreshService, services: true do
reload_mrs
reload_mrs
end
end
it
{
expect
(
@merge_request
.
notes
.
last
.
note
).
to
include
(
'merged'
)
}
it
'updates the merge state'
do
it
{
expect
(
@merge_request
).
to
be_merged
}
expect
(
@merge_request
.
notes
.
last
.
note
).
to
include
(
'merged'
)
it
{
expect
(
@merge_request
.
approvals
).
not_to
be_empty
}
expect
(
@merge_request
).
to
be_merged
it
{
expect
(
@fork_merge_request
).
to
be_merged
}
expect
(
@fork_merge_request
).
to
be_merged
it
{
expect
(
@fork_merge_request
.
notes
.
last
.
note
).
to
include
(
'merged'
)
}
expect
(
@fork_merge_request
.
notes
.
last
.
note
).
to
include
(
'merged'
)
it
{
expect
(
@fork_merge_request
.
approvals
).
not_to
be_empty
}
expect
(
@build_failed_todo
).
to
be_done
it
{
expect
(
@build_failed_todo
).
to
be_done
}
expect
(
@fork_build_failed_todo
).
to
be_done
it
{
expect
(
@fork_build_failed_todo
).
to
be_done
}
# EE-only
expect
(
@merge_request
.
approvals
).
not_to
be_empty
expect
(
@fork_merge_request
.
approvals
).
not_to
be_empty
end
end
end
context
'manual merge of source branch'
do
context
'manual merge of source branch'
do
...
@@ -107,13 +111,15 @@ describe MergeRequests::RefreshService, services: true do
...
@@ -107,13 +111,15 @@ describe MergeRequests::RefreshService, services: true do
reload_mrs
reload_mrs
end
end
it
{
expect
(
@merge_request
.
notes
.
last
.
note
).
to
include
(
'merged'
)
}
it
'updates the merge state'
do
it
{
expect
(
@merge_request
).
to
be_merged
}
expect
(
@merge_request
.
notes
.
last
.
note
).
to
include
(
'merged'
)
it
{
expect
(
@merge_request
.
diffs
.
size
).
to
be
>
0
}
expect
(
@merge_request
).
to
be_merged
it
{
expect
(
@fork_merge_request
).
to
be_merged
}
expect
(
@merge_request
.
diffs
.
size
).
to
be
>
0
it
{
expect
(
@fork_merge_request
.
notes
.
last
.
note
).
to
include
(
'merged'
)
}
expect
(
@fork_merge_request
).
to
be_merged
it
{
expect
(
@build_failed_todo
).
to
be_done
}
expect
(
@fork_merge_request
.
notes
.
last
.
note
).
to
include
(
'merged'
)
it
{
expect
(
@fork_build_failed_todo
).
to
be_done
}
expect
(
@build_failed_todo
).
to
be_done
expect
(
@fork_build_failed_todo
).
to
be_done
end
end
end
context
'push to fork repo source branch'
do
context
'push to fork repo source branch'
do
...
@@ -129,16 +135,17 @@ describe MergeRequests::RefreshService, services: true do
...
@@ -129,16 +135,17 @@ describe MergeRequests::RefreshService, services: true do
it
'executes hooks with update action'
do
it
'executes hooks with update action'
do
expect
(
refresh_service
).
to
have_received
(
:execute_hooks
).
expect
(
refresh_service
).
to
have_received
(
:execute_hooks
).
with
(
@fork_merge_request
,
'update'
,
@oldrev
)
with
(
@fork_merge_request
,
'update'
,
@oldrev
)
end
it
{
expect
(
@merge_request
.
notes
).
to
be_empty
}
expect
(
@merge_request
.
notes
).
to
be_empty
it
{
expect
(
@merge_request
).
to
be_open
}
expect
(
@merge_request
).
to
be_open
it
{
expect
(
@merge_request
.
approvals
).
not_to
be_empty
}
expect
(
@fork_merge_request
.
notes
.
last
.
note
).
to
include
(
'added 28 commits'
)
it
{
expect
(
@fork_merge_request
.
notes
.
last
.
note
).
to
include
(
'added 28 commits'
)
}
expect
(
@fork_merge_request
).
to
be_open
it
{
expect
(
@fork_merge_request
).
to
be_open
}
expect
(
@build_failed_todo
).
to
be_pending
it
{
expect
(
@build_failed_todo
).
to
be_pending
}
expect
(
@fork_build_failed_todo
).
to
be_pending
it
{
expect
(
@fork_build_failed_todo
).
to
be_pending
}
# EE-only
it
{
expect
(
@fork_merge_request
.
approvals
).
to
be_empty
}
expect
(
@merge_request
.
approvals
).
not_to
be_empty
expect
(
@fork_merge_request
.
approvals
).
to
be_empty
end
end
end
context
'closed fork merge request'
do
context
'closed fork merge request'
do
...
@@ -153,14 +160,17 @@ describe MergeRequests::RefreshService, services: true do
...
@@ -153,14 +160,17 @@ describe MergeRequests::RefreshService, services: true do
expect
(
refresh_service
).
not_to
have_received
(
:execute_hooks
)
expect
(
refresh_service
).
not_to
have_received
(
:execute_hooks
)
end
end
it
{
expect
(
@merge_request
.
notes
).
to
be_empty
}
it
'updates merge request to closed state'
do
it
{
expect
(
@merge_request
).
to
be_open
}
expect
(
@merge_request
.
notes
).
to
be_empty
it
{
expect
(
@merge_request
.
approvals
).
not_to
be_empty
}
expect
(
@merge_request
).
to
be_open
it
{
expect
(
@fork_merge_request
.
notes
).
to
be_empty
}
expect
(
@fork_merge_request
.
notes
).
to
be_empty
it
{
expect
(
@fork_merge_request
).
to
be_closed
}
expect
(
@fork_merge_request
).
to
be_closed
it
{
expect
(
@build_failed_todo
).
to
be_pending
}
expect
(
@build_failed_todo
).
to
be_pending
it
{
expect
(
@fork_build_failed_todo
).
to
be_pending
}
expect
(
@fork_build_failed_todo
).
to
be_pending
it
{
expect
(
@fork_merge_request
.
approvals
).
to
be_empty
}
# EE-only
expect
(
@merge_request
.
approvals
).
not_to
be_empty
expect
(
@fork_merge_request
.
approvals
).
to
be_empty
end
end
end
end
end
...
@@ -171,14 +181,17 @@ describe MergeRequests::RefreshService, services: true do
...
@@ -171,14 +181,17 @@ describe MergeRequests::RefreshService, services: true do
reload_mrs
reload_mrs
end
end
it
{
expect
(
@merge_request
.
notes
).
to
be_empty
}
it
'updates the merge request state'
do
it
{
expect
(
@merge_request
).
to
be_open
}
expect
(
@merge_request
.
notes
).
to
be_empty
it
{
expect
(
@merge_request
.
approvals
).
not_to
be_empty
}
expect
(
@merge_request
).
to
be_open
it
{
expect
(
@fork_merge_request
.
notes
).
to
be_empty
}
expect
(
@fork_merge_request
.
notes
).
to
be_empty
it
{
expect
(
@fork_merge_request
).
to
be_open
}
expect
(
@fork_merge_request
).
to
be_open
it
{
expect
(
@fork_merge_request
.
approvals
).
not_to
be_empty
}
expect
(
@build_failed_todo
).
to
be_pending
it
{
expect
(
@build_failed_todo
).
to
be_pending
}
expect
(
@fork_build_failed_todo
).
to
be_pending
it
{
expect
(
@fork_build_failed_todo
).
to
be_pending
}
# EE-only
expect
(
@merge_request
.
approvals
).
not_to
be_empty
expect
(
@fork_merge_request
.
approvals
).
not_to
be_empty
end
end
end
describe
'merge request diff'
do
describe
'merge request diff'
do
...
@@ -197,14 +210,17 @@ describe MergeRequests::RefreshService, services: true do
...
@@ -197,14 +210,17 @@ describe MergeRequests::RefreshService, services: true do
reload_mrs
reload_mrs
end
end
it
{
expect
(
@merge_request
.
notes
.
last
.
note
).
to
include
(
'merged'
)
}
it
'updates the merge request state'
do
it
{
expect
(
@merge_request
).
to
be_merged
}
expect
(
@merge_request
.
notes
.
last
.
note
).
to
include
(
'merged'
)
it
{
expect
(
@merge_request
.
approvals
).
not_to
be_empty
}
expect
(
@merge_request
).
to
be_merged
it
{
expect
(
@fork_merge_request
).
to
be_open
}
expect
(
@fork_merge_request
).
to
be_open
it
{
expect
(
@fork_merge_request
.
notes
).
to
be_empty
}
expect
(
@fork_merge_request
.
notes
).
to
be_empty
it
{
expect
(
@build_failed_todo
).
to
be_done
}
expect
(
@build_failed_todo
).
to
be_done
it
{
expect
(
@fork_build_failed_todo
).
to
be_done
}
expect
(
@fork_build_failed_todo
).
to
be_done
it
{
expect
(
@fork_merge_request
.
approvals
).
not_to
be_empty
}
# EE-only
expect
(
@merge_request
.
approvals
).
not_to
be_empty
expect
(
@fork_merge_request
.
approvals
).
not_to
be_empty
end
end
end
context
'resetting approvals if they are enabled'
do
context
'resetting approvals if they are enabled'
do
...
...
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