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
cc9604f9
Commit
cc9604f9
authored
Mar 11, 2021
by
Christian Couder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor all tests even more
parent
bc0c52f2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
110 deletions
+32
-110
spec/services/merge_requests/push_options_handler_service_spec.rb
...vices/merge_requests/push_options_handler_service_spec.rb
+32
-110
No files found.
spec/services/merge_requests/push_options_handler_service_spec.rb
View file @
cc9604f9
...
@@ -105,6 +105,18 @@ RSpec.describe MergeRequests::PushOptionsHandlerService do
...
@@ -105,6 +105,18 @@ RSpec.describe MergeRequests::PushOptionsHandlerService do
include_examples
'a service that does not update a merge request'
include_examples
'a service that does not update a merge request'
end
end
shared_examples
'with a deleted branch'
do
let
(
:changes
)
{
deleted_branch_changes
}
it_behaves_like
'a service that does nothing'
end
shared_examples
'with the project default branch'
do
let
(
:changes
)
{
default_branch_changes
}
it_behaves_like
'a service that does nothing'
end
describe
'`create` push option'
do
describe
'`create` push option'
do
let
(
:push_options
)
{
{
create:
true
}
}
let
(
:push_options
)
{
{
create:
true
}
}
...
@@ -127,17 +139,8 @@ RSpec.describe MergeRequests::PushOptionsHandlerService do
...
@@ -127,17 +139,8 @@ RSpec.describe MergeRequests::PushOptionsHandlerService do
it_behaves_like
'a service that does not create a merge request'
it_behaves_like
'a service that does not create a merge request'
end
end
context
'with a deleted branch'
do
it_behaves_like
'with a deleted branch'
let
(
:changes
)
{
deleted_branch_changes
}
it_behaves_like
'with the project default branch'
it_behaves_like
'a service that does nothing'
end
context
'with the project default branch'
do
let
(
:changes
)
{
default_branch_changes
}
it_behaves_like
'a service that does nothing'
end
end
end
describe
'`merge_when_pipeline_succeeds` push option'
do
describe
'`merge_when_pipeline_succeeds` push option'
do
...
@@ -189,17 +192,8 @@ RSpec.describe MergeRequests::PushOptionsHandlerService do
...
@@ -189,17 +192,8 @@ RSpec.describe MergeRequests::PushOptionsHandlerService do
it_behaves_like
'a service that can set the merge request to merge when pipeline succeeds'
it_behaves_like
'a service that can set the merge request to merge when pipeline succeeds'
end
end
context
'with a deleted branch'
do
it_behaves_like
'with a deleted branch'
let
(
:changes
)
{
deleted_branch_changes
}
it_behaves_like
'with the project default branch'
it_behaves_like
'a service that does nothing'
end
context
'with the project default branch'
do
let
(
:changes
)
{
default_branch_changes
}
it_behaves_like
'a service that does nothing'
end
end
end
describe
'`remove_source_branch` push option'
do
describe
'`remove_source_branch` push option'
do
...
@@ -251,17 +245,8 @@ RSpec.describe MergeRequests::PushOptionsHandlerService do
...
@@ -251,17 +245,8 @@ RSpec.describe MergeRequests::PushOptionsHandlerService do
it_behaves_like
'a service that can remove the source branch when it is merged'
it_behaves_like
'a service that can remove the source branch when it is merged'
end
end
context
'with a deleted branch'
do
it_behaves_like
'with a deleted branch'
let
(
:changes
)
{
deleted_branch_changes
}
it_behaves_like
'with the project default branch'
it_behaves_like
'a service that does nothing'
end
context
'with the project default branch'
do
let
(
:changes
)
{
default_branch_changes
}
it_behaves_like
'a service that does nothing'
end
end
end
describe
'`target` push option'
do
describe
'`target` push option'
do
...
@@ -313,17 +298,8 @@ RSpec.describe MergeRequests::PushOptionsHandlerService do
...
@@ -313,17 +298,8 @@ RSpec.describe MergeRequests::PushOptionsHandlerService do
it_behaves_like
'a service that can set the target of a merge request'
it_behaves_like
'a service that can set the target of a merge request'
end
end
context
'with a deleted branch'
do
it_behaves_like
'with a deleted branch'
let
(
:changes
)
{
deleted_branch_changes
}
it_behaves_like
'with the project default branch'
it_behaves_like
'a service that does nothing'
end
context
'with the project default branch'
do
let
(
:changes
)
{
default_branch_changes
}
it_behaves_like
'a service that does nothing'
end
end
end
describe
'`title` push option'
do
describe
'`title` push option'
do
...
@@ -375,17 +351,8 @@ RSpec.describe MergeRequests::PushOptionsHandlerService do
...
@@ -375,17 +351,8 @@ RSpec.describe MergeRequests::PushOptionsHandlerService do
it_behaves_like
'a service that can set the title of a merge request'
it_behaves_like
'a service that can set the title of a merge request'
end
end
context
'with a deleted branch'
do
it_behaves_like
'with a deleted branch'
let
(
:changes
)
{
deleted_branch_changes
}
it_behaves_like
'with the project default branch'
it_behaves_like
'a service that does nothing'
end
context
'with the project default branch'
do
let
(
:changes
)
{
default_branch_changes
}
it_behaves_like
'a service that does nothing'
end
end
end
describe
'`description` push option'
do
describe
'`description` push option'
do
...
@@ -437,17 +404,8 @@ RSpec.describe MergeRequests::PushOptionsHandlerService do
...
@@ -437,17 +404,8 @@ RSpec.describe MergeRequests::PushOptionsHandlerService do
it_behaves_like
'a service that can set the description of a merge request'
it_behaves_like
'a service that can set the description of a merge request'
end
end
context
'with a deleted branch'
do
it_behaves_like
'with a deleted branch'
let
(
:changes
)
{
deleted_branch_changes
}
it_behaves_like
'with the project default branch'
it_behaves_like
'a service that does nothing'
end
context
'with the project default branch'
do
let
(
:changes
)
{
default_branch_changes
}
it_behaves_like
'a service that does nothing'
end
end
end
describe
'`label` push option'
do
describe
'`label` push option'
do
...
@@ -499,17 +457,8 @@ RSpec.describe MergeRequests::PushOptionsHandlerService do
...
@@ -499,17 +457,8 @@ RSpec.describe MergeRequests::PushOptionsHandlerService do
it_behaves_like
'a service that can change labels of a merge request'
,
2
it_behaves_like
'a service that can change labels of a merge request'
,
2
end
end
context
'with a deleted branch'
do
it_behaves_like
'with a deleted branch'
let
(
:changes
)
{
deleted_branch_changes
}
it_behaves_like
'with the project default branch'
it_behaves_like
'a service that does nothing'
end
context
'with the project default branch'
do
let
(
:changes
)
{
default_branch_changes
}
it_behaves_like
'a service that does nothing'
end
end
end
describe
'`unlabel` push option'
do
describe
'`unlabel` push option'
do
...
@@ -561,17 +510,8 @@ RSpec.describe MergeRequests::PushOptionsHandlerService do
...
@@ -561,17 +510,8 @@ RSpec.describe MergeRequests::PushOptionsHandlerService do
it_behaves_like
'a service that can change labels of a merge request'
,
1
it_behaves_like
'a service that can change labels of a merge request'
,
1
end
end
context
'with a deleted branch'
do
it_behaves_like
'with a deleted branch'
let
(
:changes
)
{
deleted_branch_changes
}
it_behaves_like
'with the project default branch'
it_behaves_like
'a service that does nothing'
end
context
'with the project default branch'
do
let
(
:changes
)
{
default_branch_changes
}
it_behaves_like
'a service that does nothing'
end
end
end
shared_examples
'with an existing branch that has a merge request open in foss'
do
shared_examples
'with an existing branch that has a merge request open in foss'
do
...
@@ -591,17 +531,8 @@ RSpec.describe MergeRequests::PushOptionsHandlerService do
...
@@ -591,17 +531,8 @@ RSpec.describe MergeRequests::PushOptionsHandlerService do
it_behaves_like
'with an existing branch but no open MR'
,
1
it_behaves_like
'with an existing branch but no open MR'
,
1
it_behaves_like
'with an existing branch that has a merge request open in foss'
it_behaves_like
'with an existing branch that has a merge request open in foss'
context
'with a deleted branch'
do
it_behaves_like
'with a deleted branch'
let
(
:changes
)
{
deleted_branch_changes
}
it_behaves_like
'with the project default branch'
it_behaves_like
'a service that does nothing'
end
context
'with the project default branch'
do
let
(
:changes
)
{
default_branch_changes
}
it_behaves_like
'a service that does nothing'
end
end
end
describe
'`unassign` push option'
do
describe
'`unassign` push option'
do
...
@@ -613,17 +544,8 @@ RSpec.describe MergeRequests::PushOptionsHandlerService do
...
@@ -613,17 +544,8 @@ RSpec.describe MergeRequests::PushOptionsHandlerService do
it_behaves_like
'with an existing branch but no open MR'
,
1
it_behaves_like
'with an existing branch but no open MR'
,
1
it_behaves_like
'with an existing branch that has a merge request open in foss'
it_behaves_like
'with an existing branch that has a merge request open in foss'
context
'with a deleted branch'
do
it_behaves_like
'with a deleted branch'
let
(
:changes
)
{
deleted_branch_changes
}
it_behaves_like
'with the project default branch'
it_behaves_like
'a service that does nothing'
end
context
'with the project default branch'
do
let
(
:changes
)
{
default_branch_changes
}
it_behaves_like
'a service that does nothing'
end
end
end
describe
'multiple pushed branches'
do
describe
'multiple pushed branches'
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