2020-07-01 16:08:20 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
RSpec.describe API::Entities::SSHKey, feature_category: :authentication_and_authorization do
|
2020-07-01 16:08:20 +05:30
|
|
|
describe '#as_json' do
|
|
|
|
subject { entity.as_json }
|
|
|
|
|
|
|
|
let(:key) { create(:key, user: create(:user)) }
|
|
|
|
let(:entity) { described_class.new(key) }
|
|
|
|
|
|
|
|
it 'includes basic fields', :aggregate_failures do
|
|
|
|
is_expected.to include(
|
|
|
|
id: key.id,
|
|
|
|
title: key.title,
|
|
|
|
created_at: key.created_at,
|
|
|
|
expires_at: key.expires_at,
|
2023-03-04 22:38:38 +05:30
|
|
|
key: key.publishable_key,
|
|
|
|
usage_type: 'auth_and_signing'
|
2020-07-01 16:08:20 +05:30
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|