Module: Virtuatable::Specs::Factories::Groups
- Extended by:
- ActiveSupport::Concern
- Included in:
- Builders::Tests
- Defined in:
- lib/virtuatable/specs/factories/groups.rb
Overview
Factories concerning groups used in shared examples
Instance Method Summary collapse
-
#load_groups_factory! ⇒ Object
rubocop:disable Metrics/MethodLength.
Instance Method Details
#load_groups_factory! ⇒ Object
rubocop:disable Metrics/MethodLength
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/virtuatable/specs/factories/groups.rb', line 16 def load_groups_factory! # This avoids multiple re-declarations by setting a flag. return if self.class.class_variable_defined?(:@@groups_declared) FactoryBot.define do factory :vt_empty_group, class: Arkaan::Permissions::Group do # This creates a random group with access to zero routes. This group # won't give the users it's associated to ANY access rights. factory :random_group do slug do Faker::Alphanumeric.alphanumeric( number: 16, min_alpha: 16 ) end is_default { false } is_superuser { false } # We do NOT set the is_superuser flag to true as this factory is made to # test permissions when the route is in the list of accessible routes. factory :random_admin_group do routes { Virtuatable::Application.instance.builder.service.routes.to_a } end end end end # rubocop:disable Style/ClassVars @@groups_declared = true # rubocop:enable Style/ClassVars end |