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
25caf20c
Commit
25caf20c
authored
Nov 14, 2017
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move merge service specs to EE module
parent
01932584
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
52 deletions
+52
-52
spec/ee/spec/services/ee/merge_requests/merge_service_spec.rb
.../ee/spec/services/ee/merge_requests/merge_service_spec.rb
+52
-0
spec/services/merge_requests/merge_service_spec.rb
spec/services/merge_requests/merge_service_spec.rb
+0
-52
No files found.
spec/ee/spec/services/ee/merge_requests/merge_service_spec.rb
View file @
25caf20c
...
...
@@ -26,4 +26,56 @@ describe MergeRequests::MergeService do
end
end
end
describe
'#hooks_validation_pass?'
do
shared_examples
'hook validations are skipped when push rules unlicensed'
do
subject
{
service
.
hooks_validation_pass?
(
merge_request
)
}
before
do
stub_licensed_features
(
push_rules:
false
)
end
it
{
is_expected
.
to
be_truthy
}
end
let
(
:service
)
{
described_class
.
new
(
project
,
user
,
commit_message:
'Awesome message'
)
}
it
'returns true when valid'
do
expect
(
service
.
hooks_validation_pass?
(
merge_request
)).
to
be_truthy
end
context
'commit message validation'
do
before
do
allow
(
project
).
to
receive
(
:push_rule
)
{
build
(
:push_rule
,
commit_message_regex:
'unmatched pattern .*'
)
}
end
it_behaves_like
'hook validations are skipped when push rules unlicensed'
it
'returns false and saves error when invalid'
do
expect
(
service
.
hooks_validation_pass?
(
merge_request
)).
to
be_falsey
expect
(
merge_request
.
merge_error
).
not_to
be_empty
end
end
context
'authors email validation'
do
before
do
allow
(
project
).
to
receive
(
:push_rule
)
{
build
(
:push_rule
,
author_email_regex:
'.*@unmatchedemaildomain.com'
)
}
end
it_behaves_like
'hook validations are skipped when push rules unlicensed'
it
'returns false and saves error when invalid'
do
expect
(
service
.
hooks_validation_pass?
(
merge_request
)).
to
be_falsey
expect
(
merge_request
.
merge_error
).
not_to
be_empty
end
end
context
'fast forward merge request'
do
it
'returns true when fast forward is enabled'
do
allow
(
project
).
to
receive
(
:merge_requests_ff_only_enabled
)
{
true
}
expect
(
service
.
hooks_validation_pass?
(
merge_request
)).
to
be_truthy
end
end
end
end
spec/services/merge_requests/merge_service_spec.rb
View file @
25caf20c
...
...
@@ -306,56 +306,4 @@ describe MergeRequests::MergeService do
end
end
end
describe
'#hooks_validation_pass?'
do
shared_examples
'hook validations are skipped when push rules unlicensed'
do
subject
{
service
.
hooks_validation_pass?
(
merge_request
)
}
before
do
stub_licensed_features
(
push_rules:
false
)
end
it
{
is_expected
.
to
be_truthy
}
end
let
(
:service
)
{
described_class
.
new
(
project
,
user
,
commit_message:
'Awesome message'
)
}
it
'returns true when valid'
do
expect
(
service
.
hooks_validation_pass?
(
merge_request
)).
to
be_truthy
end
context
'commit message validation'
do
before
do
allow
(
project
).
to
receive
(
:push_rule
)
{
build
(
:push_rule
,
commit_message_regex:
'unmatched pattern .*'
)
}
end
it_behaves_like
'hook validations are skipped when push rules unlicensed'
it
'returns false and saves error when invalid'
do
expect
(
service
.
hooks_validation_pass?
(
merge_request
)).
to
be_falsey
expect
(
merge_request
.
merge_error
).
not_to
be_empty
end
end
context
'authors email validation'
do
before
do
allow
(
project
).
to
receive
(
:push_rule
)
{
build
(
:push_rule
,
author_email_regex:
'.*@unmatchedemaildomain.com'
)
}
end
it_behaves_like
'hook validations are skipped when push rules unlicensed'
it
'returns false and saves error when invalid'
do
expect
(
service
.
hooks_validation_pass?
(
merge_request
)).
to
be_falsey
expect
(
merge_request
.
merge_error
).
not_to
be_empty
end
end
context
'fast forward merge request'
do
it
'returns true when fast forward is enabled'
do
allow
(
project
).
to
receive
(
:merge_requests_ff_only_enabled
)
{
true
}
expect
(
service
.
hooks_validation_pass?
(
merge_request
)).
to
be_truthy
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