Commit 6aae7d57 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch 'remove-wrong-queries-for-plan' into 'master'

Fix group_plan in system hook data

See merge request gitlab-org/gitlab!29013
parents b3da618c 7cfcabbe
......@@ -9,7 +9,7 @@ module EE
override :group_member_data
def group_member_data(model)
super.tap do |data|
data[:group_plan] = model.group.plan&.name
data[:group_plan] = model.group.gitlab_subscription&.plan_name
end
end
......
---
title: Fix group_plan in group member data for system hooks
merge_request: 29013
author:
type: fixed
......@@ -3,17 +3,27 @@
require 'spec_helper'
describe EE::SystemHooksService do
let(:group_member) { create(:group_member) }
let(:user) { create(:user) }
context 'when group member' do
let(:group) { create(:group) }
let(:group_member) { create(:group_member, group: group) }
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
context 'with a Gold plan' do
let(:group) { create(:group_with_plan, plan: :gold_plan) }
it 'returns correct group_plan' do
expect(event_data(group_member, :create)[:group_plan]).to eq('gold')
end
end
end
context 'when user' do
let_it_be(:user) { create(:user) }
context 'event data' do
context 'for GitLab.com' do
before do
......
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