diff --git a/spec/enterprise/controllers/api/v1/accounts/custom_roles_controller_spec.rb b/spec/enterprise/controllers/api/v1/accounts/custom_roles_controller_spec.rb index 89af9d26c..5c6d96a7b 100644 --- a/spec/enterprise/controllers/api/v1/accounts/custom_roles_controller_spec.rb +++ b/spec/enterprise/controllers/api/v1/accounts/custom_roles_controller_spec.rb @@ -69,7 +69,8 @@ RSpec.describe 'Custom Roles API', type: :request do describe 'POST #create' do let(:valid_params) do - { custom_role: { name: 'Support', description: 'Support role', permissions: CustomRole::PERMISSIONS.sample(SecureRandom.random_number(4)) } } + { custom_role: { name: 'Support', description: 'Support role', + permissions: CustomRole::PERMISSIONS.sample(SecureRandom.random_number(1..4)) } } end context 'when it is an authenticated administrator' do diff --git a/spec/factories/custom_roles.rb b/spec/factories/custom_roles.rb index 7a3ca7f3f..542f9dae1 100644 --- a/spec/factories/custom_roles.rb +++ b/spec/factories/custom_roles.rb @@ -3,6 +3,6 @@ FactoryBot.define do account name { Faker::Name.name } description { Faker::Lorem.sentence } - permissions { CustomRole::PERMISSIONS.sample(SecureRandom.random_number(4)) } + permissions { CustomRole::PERMISSIONS.sample(SecureRandom.random_number(1..4)) } end end