debian-mirror-gitlab/spec/models/releases/source_spec.rb

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

43 lines
1,001 B
Ruby
Raw Normal View History

2019-02-15 15:39:39 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe Releases::Source do
2023-07-09 08:55:56 +05:30
let_it_be(:project) { create(:project, :repository) }
2021-06-08 01:23:25 +05:30
2019-02-15 15:39:39 +05:30
let(:tag_name) { 'v1.0' }
describe '.all' do
subject { described_class.all(project, tag_name) }
it 'returns all formats of sources' do
expect(subject.map(&:format))
2019-12-26 22:10:19 +05:30
.to match_array(Gitlab::Workhorse::ARCHIVE_FORMATS)
2019-02-15 15:39:39 +05:30
end
end
describe '#url' do
subject { source.url }
let(:source) do
described_class.new(project: project, tag_name: tag_name, format: format)
end
let(:format) { 'zip' }
it 'returns zip archived source url' do
is_expected
2023-07-09 08:55:56 +05:30
.to eq("#{project.web_url}/-/archive/v1.0/#{project.path}-v1.0.zip")
2019-02-15 15:39:39 +05:30
end
context 'when ref is directory structure' do
let(:tag_name) { 'beta/v1.0' }
it 'converts slash to dash' do
is_expected
2023-07-09 08:55:56 +05:30
.to eq("#{project.web_url}/-/archive/beta/v1.0/#{project.path}-beta-v1.0.zip")
2019-02-15 15:39:39 +05:30
end
end
end
end