debian-mirror-gitlab/spec/tasks/gitlab/packages/composer_rake_spec.rb

30 lines
1.3 KiB
Ruby
Raw Normal View History

2021-04-17 20:07:23 +05:30
# frozen_string_literal: true
require 'rake_helper'
2021-09-04 01:27:46 +05:30
RSpec.describe 'gitlab:packages:build_composer_cache namespace rake task', :silence_stdout do
2021-04-17 20:07:23 +05:30
let_it_be(:package_name) { 'sample-project' }
let_it_be(:package_name2) { 'sample-project2' }
let_it_be(:json) { { 'name' => package_name } }
let_it_be(:json2) { { 'name' => package_name2 } }
let_it_be(:group) { create(:group) }
let_it_be(:project) { create(:project, :custom_repo, files: { 'composer.json' => json.to_json }, group: group) }
let_it_be(:project2) { create(:project, :custom_repo, files: { 'composer.json' => json2.to_json }, group: group) }
2021-09-30 23:02:18 +05:30
2021-04-17 20:07:23 +05:30
let!(:package) { create(:composer_package, :with_metadatum, project: project, name: package_name, version: '1.0.0', json: json) }
let!(:package2) { create(:composer_package, :with_metadatum, project: project, name: package_name, version: '2.0.0', json: json) }
let!(:package3) { create(:composer_package, :with_metadatum, project: project2, name: package_name2, version: '3.0.0', json: json2) }
before :all do
Rake.application.rake_require 'tasks/gitlab/packages/composer'
end
subject do
run_rake_task("gitlab:packages:build_composer_cache")
end
it 'generates the cache files' do
expect { subject }.to change { Packages::Composer::CacheFile.count }.by(2)
end
end