summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-07-26 15:08:30 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-07-26 15:08:30 +0000
commit81f9ca3c644d6e14de09b61202b67dbb6e321fe7 (patch)
treef50d13f5c821630153808febce1897bde5aa5f19 /spec
parentc4af99d56fdef59d1da557d88a334f52e7531eb3 (diff)
downloadgitlab-ce-81f9ca3c644d6e14de09b61202b67dbb6e321fe7.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r--spec/frontend/repository/components/delete_blob_modal_spec.js20
-rw-r--r--spec/support/shared_examples/lib/menus_shared_examples.rb39
-rw-r--r--spec/support/shared_examples/models/packages/debian/distribution_shared_examples.rb14
-rw-r--r--spec/uploaders/packages/debian/distribution_release_file_uploader_spec.rb10
4 files changed, 72 insertions, 11 deletions
diff --git a/spec/frontend/repository/components/delete_blob_modal_spec.js b/spec/frontend/repository/components/delete_blob_modal_spec.js
index a74e3e6d325..78e288a8ba4 100644
--- a/spec/frontend/repository/components/delete_blob_modal_spec.js
+++ b/spec/frontend/repository/components/delete_blob_modal_spec.js
@@ -1,5 +1,5 @@
-import { GlFormTextarea, GlModal, GlFormInput, GlToggle } from '@gitlab/ui';
-import { shallowMount } from '@vue/test-utils';
+import { GlFormTextarea, GlModal, GlFormInput, GlToggle, GlForm } from '@gitlab/ui';
+import { shallowMount, mount } from '@vue/test-utils';
import { nextTick } from 'vue';
import DeleteBlobModal from '~/repository/components/delete_blob_modal.vue';
@@ -19,17 +19,24 @@ const initialProps = {
describe('DeleteBlobModal', () => {
let wrapper;
- const createComponent = (props = {}) => {
- wrapper = shallowMount(DeleteBlobModal, {
+ const createComponentFactory = (mountFn) => (props = {}) => {
+ wrapper = mountFn(DeleteBlobModal, {
propsData: {
...initialProps,
...props,
},
+ attrs: {
+ static: true,
+ visible: true,
+ },
});
};
+ const createComponent = createComponentFactory(shallowMount);
+ const createFullComponent = createComponentFactory(mount);
+
const findModal = () => wrapper.findComponent(GlModal);
- const findForm = () => wrapper.findComponent({ ref: 'form' });
+ const findForm = () => findModal().findComponent(GlForm);
afterEach(() => {
wrapper.destroy();
@@ -59,7 +66,8 @@ describe('DeleteBlobModal', () => {
});
it('submits the form', async () => {
- createComponent();
+ createFullComponent();
+ await nextTick();
const submitSpy = jest.spyOn(findForm().element, 'submit');
findModal().vm.$emit('primary', { preventDefault: () => {} });
diff --git a/spec/support/shared_examples/lib/menus_shared_examples.rb b/spec/support/shared_examples/lib/menus_shared_examples.rb
new file mode 100644
index 00000000000..2c2cb362b07
--- /dev/null
+++ b/spec/support/shared_examples/lib/menus_shared_examples.rb
@@ -0,0 +1,39 @@
+# frozen_string_literal: true
+
+RSpec.shared_examples_for 'pill_count formatted results' do
+ let(:count_service) { raise NotImplementedError }
+
+ subject(:pill_count) { menu.pill_count }
+
+ it 'returns all digits for count value under 1000' do
+ allow_next_instance_of(count_service) do |service|
+ allow(service).to receive(:count).and_return(999)
+ end
+
+ expect(pill_count).to eq('999')
+ end
+
+ it 'returns truncated digits for count value over 1000' do
+ allow_next_instance_of(count_service) do |service|
+ allow(service).to receive(:count).and_return(2300)
+ end
+
+ expect(pill_count).to eq('2.3k')
+ end
+
+ it 'returns truncated digits for count value over 10000' do
+ allow_next_instance_of(count_service) do |service|
+ allow(service).to receive(:count).and_return(12560)
+ end
+
+ expect(pill_count).to eq('12.6k')
+ end
+
+ it 'returns truncated digits for count value over 100000' do
+ allow_next_instance_of(count_service) do |service|
+ allow(service).to receive(:count).and_return(112560)
+ end
+
+ expect(pill_count).to eq('112.6k')
+ end
+end
diff --git a/spec/support/shared_examples/models/packages/debian/distribution_shared_examples.rb b/spec/support/shared_examples/models/packages/debian/distribution_shared_examples.rb
index 5459d17b1df..274fbae3dfd 100644
--- a/spec/support/shared_examples/models/packages/debian/distribution_shared_examples.rb
+++ b/spec/support/shared_examples/models/packages/debian/distribution_shared_examples.rb
@@ -128,10 +128,6 @@ RSpec.shared_examples 'Debian Distribution' do |factory, container, can_freeze|
it { is_expected.not_to allow_value(12.hours.to_i).for(:valid_time_duration_seconds) }
end
- describe '#signing_keys' do
- it { is_expected.to validate_absence_of(:signing_keys) }
- end
-
describe '#file' do
it { is_expected.not_to validate_presence_of(:file) }
end
@@ -141,7 +137,15 @@ RSpec.shared_examples 'Debian Distribution' do |factory, container, can_freeze|
end
describe '#file_signature' do
- it { is_expected.to validate_absence_of(:file_signature) }
+ it { is_expected.not_to validate_absence_of(:file_signature) }
+ end
+
+ describe '#signed_file' do
+ it { is_expected.not_to validate_presence_of(:signed_file) }
+ end
+
+ describe '#signed_file_store' do
+ it { is_expected.to validate_presence_of(:signed_file_store) }
end
end
diff --git a/spec/uploaders/packages/debian/distribution_release_file_uploader_spec.rb b/spec/uploaders/packages/debian/distribution_release_file_uploader_spec.rb
index d36bfac4de8..203a453bcdd 100644
--- a/spec/uploaders/packages/debian/distribution_release_file_uploader_spec.rb
+++ b/spec/uploaders/packages/debian/distribution_release_file_uploader_spec.rb
@@ -47,6 +47,16 @@ RSpec.describe Packages::Debian::DistributionReleaseFileUploader do
end
end
end
+
+ describe '#filename' do
+ it { expect(subject.filename).to eq('Release')}
+
+ context 'with signed_file' do
+ let(:uploader) { described_class.new(distribution, :signed_file) }
+
+ it { expect(subject.filename).to eq('InRelease')}
+ end
+ end
end
end
end