BigW Consortium Gitlab

group_members_shared_example.rb 869 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
RSpec.shared_examples 'members and requesters associations' do
  describe '#members_and_requesters' do
    it 'includes members and requesters' do
      member_and_requester_user_ids = namespace.members_and_requesters.pluck(:user_id)

      expect(member_and_requester_user_ids).to include(requester.id, developer.id)
    end
  end

  describe '#members' do
    it 'includes members and exclude requesters' do
      member_user_ids = namespace.members.pluck(:user_id)

      expect(member_user_ids).to include(developer.id)
      expect(member_user_ids).not_to include(requester.id)
    end
  end

  describe '#requesters' do
    it 'does not include requesters' do
      requester_user_ids = namespace.requesters.pluck(:user_id)

      expect(requester_user_ids).to include(requester.id)
      expect(requester_user_ids).not_to include(developer.id)
    end
  end
end