Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/packages/debian')
-rw-r--r--spec/models/packages/debian/group_component_file_spec.rb7
-rw-r--r--spec/models/packages/debian/group_component_spec.rb7
-rw-r--r--spec/models/packages/debian/project_component_file_spec.rb7
-rw-r--r--spec/models/packages/debian/project_component_spec.rb7
-rw-r--r--spec/models/packages/debian/publication_spec.rb47
5 files changed, 75 insertions, 0 deletions
diff --git a/spec/models/packages/debian/group_component_file_spec.rb b/spec/models/packages/debian/group_component_file_spec.rb
new file mode 100644
index 00000000000..bf33ca138c3
--- /dev/null
+++ b/spec/models/packages/debian/group_component_file_spec.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Packages::Debian::GroupComponentFile do
+ it_behaves_like 'Debian Component File', :group, false
+end
diff --git a/spec/models/packages/debian/group_component_spec.rb b/spec/models/packages/debian/group_component_spec.rb
new file mode 100644
index 00000000000..f288ebbe5df
--- /dev/null
+++ b/spec/models/packages/debian/group_component_spec.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Packages::Debian::GroupComponent do
+ it_behaves_like 'Debian Distribution Component', :debian_group_component, :group, false
+end
diff --git a/spec/models/packages/debian/project_component_file_spec.rb b/spec/models/packages/debian/project_component_file_spec.rb
new file mode 100644
index 00000000000..5dfc47c14c0
--- /dev/null
+++ b/spec/models/packages/debian/project_component_file_spec.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Packages::Debian::ProjectComponentFile do
+ it_behaves_like 'Debian Component File', :project, true
+end
diff --git a/spec/models/packages/debian/project_component_spec.rb b/spec/models/packages/debian/project_component_spec.rb
new file mode 100644
index 00000000000..4b041068b8d
--- /dev/null
+++ b/spec/models/packages/debian/project_component_spec.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Packages::Debian::ProjectComponent do
+ it_behaves_like 'Debian Distribution Component', :debian_project_component, :project, true
+end
diff --git a/spec/models/packages/debian/publication_spec.rb b/spec/models/packages/debian/publication_spec.rb
new file mode 100644
index 00000000000..0ed056f499b
--- /dev/null
+++ b/spec/models/packages/debian/publication_spec.rb
@@ -0,0 +1,47 @@
+# frozen_string_literal: true
+require 'spec_helper'
+
+RSpec.describe Packages::Debian::Publication, type: :model do
+ let_it_be_with_reload(:publication) { create(:debian_publication) }
+
+ subject { publication }
+
+ describe 'relationships' do
+ it { is_expected.to belong_to(:package).inverse_of(:debian_publication).class_name('Packages::Package') }
+ it { is_expected.to belong_to(:distribution).inverse_of(:publications).class_name('Packages::Debian::ProjectDistribution').with_foreign_key(:distribution_id) }
+ end
+
+ describe 'validations' do
+ describe '#package' do
+ it { is_expected.to validate_presence_of(:package) }
+ end
+
+ describe '#valid_debian_package_type' do
+ context 'with package type not being Debian' do
+ before do
+ publication.package.package_type = 'generic'
+ end
+
+ it 'will not allow package type not being Debian' do
+ expect(publication).not_to be_valid
+ expect(publication.errors.to_a).to eq(['Package type must be Debian'])
+ end
+ end
+
+ context 'with package not being a Debian package' do
+ before do
+ publication.package.version = nil
+ end
+
+ it 'will not allow package not being a distribution' do
+ expect(publication).not_to be_valid
+ expect(publication.errors.to_a).to eq(['Package must be a Debian package'])
+ end
+ end
+ end
+
+ describe '#distribution' do
+ it { is_expected.to validate_presence_of(:distribution) }
+ end
+ end
+end