debian-mirror-gitlab/spec/services/packages/go/sync_packages_service_spec.rb

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

41 lines
1.1 KiB
Ruby
Raw Permalink Normal View History

2021-04-29 21:17:54 +05:30
# frozen_string_literal: true
require 'spec_helper'
2023-05-27 22:25:52 +05:30
RSpec.describe Packages::Go::SyncPackagesService, feature_category: :package_registry do
2021-04-29 21:17:54 +05:30
include_context 'basic Go module'
let(:params) { { info: true, mod: true, zip: true } }
describe '#execute_async' do
it 'schedules a package refresh' do
expect(::Packages::Go::SyncPackagesWorker).to receive(:perform_async).once
described_class.new(project, 'master').execute_async
end
end
describe '#initialize' do
context 'without a project' do
it 'raises an error' do
expect { described_class.new(nil, 'master') }
.to raise_error(ArgumentError, 'project is required')
end
end
context 'without a ref' do
it 'raises an error' do
expect { described_class.new(project, nil) }
.to raise_error(ArgumentError, 'ref is required')
end
end
context 'with an invalid ref' do
it 'raises an error' do
expect { described_class.new(project, 'not-a-ref') }
.to raise_error(ArgumentError)
end
end
end
end