```ruby
FactoryBot.define do
  factory :membership do
    state { Membership.states.keys.sample }
    roles ["group_member"]
    user
    user_group
  end
end
```

Remove randomness from membership factory
user
```ruby
FactoryBot.define do
  factory :membership do
    state { :active }
    roles ["group_member"]
    user
    user_group
  end
end
```
assistant