debian-mirror-gitlab/spec/serializers/group_access_token_serializer_spec.rb
2022-08-27 11:52:29 +05:30

28 lines
700 B
Ruby

# frozen_string_literal: true
require 'spec_helper'
RSpec.describe GroupAccessTokenSerializer do
let_it_be(:group) { create(:group) }
let_it_be(:bot) { create(:user, :project_bot) }
subject(:serializer) { described_class.new }
before do
group.add_developer(bot)
end
describe '#represent' do
it 'can render a single token' do
token = create(:personal_access_token, user: bot)
expect(serializer.represent(token, group: group)).to be_kind_of(Hash)
end
it 'can render a collection of tokens' do
tokens = create_list(:personal_access_token, 2, user: bot)
expect(serializer.represent(tokens, group: group)).to be_kind_of(Array)
end
end
end