debian-mirror-gitlab/spec/lib/api/entities/package_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

44 lines
1 KiB
Ruby
Raw Permalink Normal View History

2021-09-04 01:27:46 +05:30
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe API::Entities::Package do
let(:package) { create(:generic_package) }
subject { described_class.new(package).as_json(namespace: package.project.namespace) }
it 'exposes correct attributes' do
expect(subject).to include(
:id,
:name,
:version,
:package_type,
:status,
:_links,
:created_at,
:tags,
:versions
)
end
it 'exposes correct web_path in _links' do
expect(subject[:_links][:web_path]).to match('/packages/')
end
context 'with a terraform_module' do
let(:package) { create(:terraform_module_package) }
it 'exposes correct web_path in _links' do
expect(subject[:_links][:web_path]).to match('/infrastructure_registry/')
end
end
2023-03-04 22:38:38 +05:30
context 'when package has no default status' do
let(:package) { create(:package, :error) }
it 'does not expose web_path in _links' do
expect(subject[:_links]).not_to have_key(:web_path)
end
end
2021-09-04 01:27:46 +05:30
end