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
3712268d
Commit
3712268d
authored
Apr 02, 2020
by
Maxime Orefice
Committed by
Mayra Cabrera
Apr 02, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
De-duplicate system hooks service EE specs
parent
4acd1a97
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
31 deletions
+23
-31
.rubocop.yml
.rubocop.yml
+0
-2
ee/spec/services/ee/system_hooks_service_spec.rb
ee/spec/services/ee/system_hooks_service_spec.rb
+23
-13
ee/spec/services/system_hooks_service_spec.rb
ee/spec/services/system_hooks_service_spec.rb
+0
-16
No files found.
.rubocop.yml
View file @
3712268d
...
...
@@ -221,14 +221,12 @@ Gitlab/DuplicateSpecLocation:
-
ee/spec/services/merge_requests/create_service_spec.rb
-
ee/spec/services/merge_requests/refresh_service_spec.rb
-
ee/spec/services/merge_requests/update_service_spec.rb
-
ee/spec/services/system_hooks_service_spec.rb
-
ee/spec/helpers/ee/auth_helper_spec.rb
-
ee/spec/models/ee/namespace_spec.rb
-
ee/spec/services/ee/issues/create_service_spec.rb
-
ee/spec/services/ee/merge_requests/create_service_spec.rb
-
ee/spec/services/ee/merge_requests/refresh_service_spec.rb
-
ee/spec/services/ee/merge_requests/update_service_spec.rb
-
ee/spec/services/ee/system_hooks_service_spec.rb
Cop/InjectEnterpriseEditionModule
:
Enabled
:
true
...
...
ee/spec/services/ee/system_hooks_service_spec.rb
View file @
3712268d
...
...
@@ -3,25 +3,35 @@
require
'spec_helper'
describe
EE
::
SystemHooksService
do
let
(
:group_member
)
{
create
(
:group_member
)
}
let
(
:user
)
{
create
(
:user
)
}
context
'event data'
do
context
'for GitLab.com'
do
before
do
expect
(
Gitlab
).
to
receive
(
:com?
).
and_return
(
true
)
end
it
{
expect
(
event_data
(
user
,
:create
)).
to
include
(
:event_name
,
:name
,
:created_at
,
:updated_at
,
:email
,
:user_id
,
:username
,
:email_opted_in
,
:email_opted_in_ip
,
:email_opted_in_source
,
:email_opted_in_at
)
}
it
{
expect
(
event_data
(
user
,
:destroy
)).
to
include
(
:event_name
,
:name
,
:created_at
,
:updated_at
,
:email
,
:user_id
,
:username
,
:email_opted_in
,
:email_opted_in_ip
,
:email_opted_in_source
,
:email_opted_in_at
)
}
context
'when group member'
do
context
'event data'
do
it
{
expect
(
event_data
(
group_member
,
:create
)).
to
include
(
:event_name
,
:created_at
,
:updated_at
,
:group_name
,
:group_path
,
:group_plan
,
:group_id
,
:user_name
,
:user_username
,
:user_email
,
:user_id
,
:group_access
)
}
it
{
expect
(
event_data
(
group_member
,
:destroy
)).
to
include
(
:event_name
,
:created_at
,
:updated_at
,
:group_name
,
:group_path
,
:group_plan
,
:group_id
,
:user_name
,
:user_username
,
:user_email
,
:user_id
,
:group_access
)
}
end
end
context
'for non-GitLab.com'
do
before
do
expect
(
Gitlab
).
to
receive
(
:com?
).
and_return
(
false
)
context
'when user'
do
context
'event data'
do
context
'for GitLab.com'
do
before
do
expect
(
Gitlab
).
to
receive
(
:com?
).
and_return
(
true
)
end
it
{
expect
(
event_data
(
user
,
:create
)).
to
include
(
:event_name
,
:name
,
:created_at
,
:updated_at
,
:email
,
:user_id
,
:username
,
:email_opted_in
,
:email_opted_in_ip
,
:email_opted_in_source
,
:email_opted_in_at
)
}
it
{
expect
(
event_data
(
user
,
:destroy
)).
to
include
(
:event_name
,
:name
,
:created_at
,
:updated_at
,
:email
,
:user_id
,
:username
,
:email_opted_in
,
:email_opted_in_ip
,
:email_opted_in_source
,
:email_opted_in_at
)
}
end
it
{
expect
(
event_data
(
user
,
:create
)).
to
include
(
:event_name
,
:name
,
:created_at
,
:updated_at
,
:email
,
:user_id
,
:username
)
}
it
{
expect
(
event_data
(
user
,
:destroy
)).
to
include
(
:event_name
,
:name
,
:created_at
,
:updated_at
,
:email
,
:user_id
,
:username
)
}
context
'for non-GitLab.com'
do
before
do
expect
(
Gitlab
).
to
receive
(
:com?
).
and_return
(
false
)
end
it
{
expect
(
event_data
(
user
,
:create
)).
to
include
(
:event_name
,
:name
,
:created_at
,
:updated_at
,
:email
,
:user_id
,
:username
)
}
it
{
expect
(
event_data
(
user
,
:destroy
)).
to
include
(
:event_name
,
:name
,
:created_at
,
:updated_at
,
:email
,
:user_id
,
:username
)
}
end
end
end
...
...
ee/spec/services/system_hooks_service_spec.rb
deleted
100644 → 0
View file @
4acd1a97
# frozen_string_literal: true
require
'spec_helper'
describe
SystemHooksService
do
let
(
:group_member
)
{
create
(
:group_member
)
}
context
'event data'
do
it
{
expect
(
event_data
(
group_member
,
:create
)).
to
include
(
:event_name
,
:created_at
,
:updated_at
,
:group_name
,
:group_path
,
:group_plan
,
:group_id
,
:user_name
,
:user_username
,
:user_email
,
:user_id
,
:group_access
)
}
it
{
expect
(
event_data
(
group_member
,
:destroy
)).
to
include
(
:event_name
,
:created_at
,
:updated_at
,
:group_name
,
:group_path
,
:group_plan
,
:group_id
,
:user_name
,
:user_username
,
:user_email
,
:user_id
,
:group_access
)
}
end
def
event_data
(
*
args
)
SystemHooksService
.
new
.
send
:build_event_data
,
*
args
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