diff options
Diffstat (limited to 'spec/models/packages/dependency_spec.rb')
-rw-r--r-- | spec/models/packages/dependency_spec.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/spec/models/packages/dependency_spec.rb b/spec/models/packages/dependency_spec.rb index 1575dec98c9..80ec7f77fda 100644 --- a/spec/models/packages/dependency_spec.rb +++ b/spec/models/packages/dependency_spec.rb @@ -1,7 +1,11 @@ # frozen_string_literal: true require 'spec_helper' -RSpec.describe Packages::Dependency, type: :model do +RSpec.describe Packages::Dependency, type: :model, feature_category: :package_registry do + describe 'included modules' do + it { is_expected.to include_module(EachBatch) } + end + describe 'relationships' do it { is_expected.to have_many(:dependency_links) } end @@ -110,6 +114,19 @@ RSpec.describe Packages::Dependency, type: :model do end end + describe '.orphaned' do + let_it_be(:orphaned_dependencies) { create_list(:packages_dependency, 2) } + let_it_be(:linked_dependency) do + create(:packages_dependency).tap do |dependency| + create(:packages_dependency_link, dependency: dependency) + end + end + + it 'returns orphaned dependency records' do + expect(described_class.orphaned).to contain_exactly(*orphaned_dependencies) + end + end + def build_names_and_version_patterns(*package_dependencies) result = Hash.new { |h, dependency| h[dependency.name] = dependency.version_pattern } package_dependencies.each { |dependency| result[dependency] } |