Commit 1eada87d authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch '208897-add-user-type-consistency-tests' into 'master'

Add user_type and bot_type consistency tests

See merge request gitlab-org/gitlab!26578
parents dc9dd4f4 17f79af7
......@@ -2,9 +2,6 @@
module UserBotTypeEnums
def self.bots
# When adding a new key, please ensure you are not conflicting
# with EE-only keys in app/models/user_type_enums.rb
# or app/models/user_bot_type_enums.rb
{
alert_bot: 2
}
......
......@@ -2,9 +2,6 @@
module UserTypeEnums
def self.types
# When adding a new key, please ensure you are not conflicting
# with EE-only keys in app/models/user_type_enums.rb
# or app/models/user_bot_type_enums.rb
bots
end
......
......@@ -9,9 +9,6 @@ module EE
override :bots
def bots
# When adding a new key, please ensure you are not conflicting
# with EE-only keys in app/models/user_type_enums.rb
# or app/models/user_bot_type_enums.rb
super.merge(
support_bot: 1,
visual_review_bot: 3
......
......@@ -9,9 +9,6 @@ module EE
override :types
def types
# When adding a new key, please ensure you are not conflicting
# with EE-only keys in app/models/user_type_enums.rb
# or app/models/user_bot_type_enums.rb
super.merge(ServiceUser: 4)
end
......
# frozen_string_literal: true
require 'spec_helper'
describe UserBotTypeEnums do
it 'has no type conflicts between CE and EE', :aggregate_failures do
described_class.public_methods(false).each do |method_name|
method = described_class.method(method_name)
ee_result = method.call
ce_result = method.super_method.call
failure_message = "expected #{method} to have no value conflicts, but it has.\n
Please make sure you are not overriding values.\n
Actual values: EE #{ee_result}, CE #{ce_result}"
expect(ee_result).to include(ce_result), failure_message
expect(ee_result.values).to match_array(ee_result.values.uniq)
end
end
end
# frozen_string_literal: true
require 'spec_helper'
describe UserTypeEnums do
it 'has no type conflicts between CE and EE', :aggregate_failures do
described_class.public_methods(false).each do |method_name|
method = described_class.method(method_name)
ee_result = method.call
ce_result = method.super_method.call
failure_message = "expected #{method} to have no value conflicts, but it has.\n
Please make sure you are not overriding values.\n
Actual values: EE #{ee_result}, CE #{ce_result}"
expect(ee_result).to include(ce_result), failure_message
expect(ee_result.values).to match_array(ee_result.values.uniq)
end
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