Commit 87aeadd4 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'mo-refactor-system-hooks-service-spec' into 'master'

De-duplicate system hooks service EE specs

See merge request gitlab-org/gitlab!28470
parents b22ee346 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
......
......@@ -3,8 +3,17 @@
require 'spec_helper'
describe EE::SystemHooksService do
let(:group_member) { create(:group_member) }
let(:user) { create(:user) }
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 'when user' do
context 'event data' do
context 'for GitLab.com' do
before do
......@@ -24,6 +33,7 @@ describe EE::SystemHooksService do
it { expect(event_data(user, :destroy)).to include(:event_name, :name, :created_at, :updated_at, :email, :user_id, :username) }
end
end
end
def event_data(*args)
SystemHooksService.new.send :build_event_data, *args
......
# 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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment