Commit df86ad56 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch '212566-foss-design-management-extra-specs' into 'master'

Move some left-over Design Management specs to FOSS

See merge request gitlab-org/gitlab!31835
parents b14fd584 de4515f5
# frozen_string_literal: true
require 'spec_helper'
describe EE::Mentionable do
context Epic do
describe '#store_mentions!' do
it_behaves_like 'mentions in description', :epic
it_behaves_like 'mentions in notes', :epic do
let(:note) { create(:note_on_epic) }
let(:mentionable) { note.noteable }
end
end
describe 'load mentions' do
it_behaves_like 'load mentions from DB', :epic do
let(:note) { create(:note_on_epic) }
let(:mentionable) { note.noteable }
end
end
end
end
# frozen_string_literal: true
require 'spec_helper'
describe Epic, 'Mentionable' do
describe '#store_mentions!' do
it_behaves_like 'mentions in description', :epic
it_behaves_like 'mentions in notes', :epic do
let(:note) { create(:note_on_epic) }
let(:mentionable) { note.noteable }
end
end
describe 'load mentions' do
it_behaves_like 'load mentions from DB', :epic do
let(:note) { create(:note_on_epic) }
let(:mentionable) { note.noteable }
end
end
end
describe DesignManagement::Design do
describe '#store_mentions!' do
it_behaves_like 'mentions in notes', :design do
let(:note) { create(:diff_note_on_design) }
let(:mentionable) { note.noteable }
end
end
describe 'load mentions' do
it_behaves_like 'load mentions from DB', :design do
let(:note) { create(:diff_note_on_design) }
let(:mentionable) { note.noteable }
end
end
end
......@@ -189,16 +189,6 @@ describe Issue do
it { is_expected.to belong_to(:promoted_to_epic).class_name('Epic') }
it { is_expected.to have_many(:resource_weight_events) }
it { is_expected.to have_one(:status_page_published_incident) }
describe 'versions.most_recent' do
it 'returns the most recent version' do
issue = create(:issue)
create_list(:design_version, 2, issue: issue)
last_version = create(:design_version, issue: issue)
expect(issue.design_versions.most_recent).to eq(last_version)
end
end
end
it_behaves_like 'an editable mentionable with EE-specific mentions' do
......
......@@ -219,29 +219,6 @@ describe Repository do
end
end
describe '#lfs_enabled? (design repositories)' do
let(:project) { create(:project, :design_repo, lfs_enabled: lfs_enabled) }
let(:repository) { project.design_repository }
before do
stub_lfs_setting(enabled: true)
end
subject { repository.lfs_enabled? }
context 'project has LFS disabled' do
let(:lfs_enabled) { false }
it { is_expected.to be_falsy }
end
context 'project has LFS enabled' do
let(:lfs_enabled) { true }
it { is_expected.to be_truthy }
end
end
describe '#upstream_branch_name' do
let(:pull_mirror_branch_prefix) { 'upstream/' }
let(:branch_name) { 'upstream/master' }
......
# frozen_string_literal: true
require 'rake_helper'
describe 'gitlab:uploads:migrate and migrate_to_local rake tasks' do
let(:batch_size) { 3 }
before do
stub_env('MIGRATION_BATCH_SIZE', batch_size.to_s)
stub_uploads_object_storage(uploader_class)
Rake.application.rake_require 'tasks/gitlab/uploads/migrate'
allow(ObjectStorage::MigrateUploadsWorker).to receive(:perform_async)
end
context "for DesignManagement::DesignV432x230Uploader" do
let(:uploader_class) { DesignManagement::DesignV432x230Uploader }
let(:model_class) { DesignManagement::Action }
let(:mounted_as) { :image_v432x230 }
before do
create_list(:design_action, 10, :with_image_v432x230)
end
it_behaves_like 'enqueue upload migration jobs in batch', batch: 4
end
end
# frozen_string_literal: true
require 'spec_helper'
describe ObjectStorage::MigrateUploadsWorker do
let(:model_class) { Project }
let(:uploads) { Upload.all }
let(:to_store) { ObjectStorage::Store::REMOTE }
context 'for DesignManagement::DesignV432x230Uploader' do
let(:model_class) { DesignManagement::Action }
let!(:design_actions) { create_list(:design_action, 10, :with_image_v432x230) }
let(:mounted_as) { :image_v432x230 }
before do
stub_uploads_object_storage(DesignManagement::DesignV432x230Uploader)
end
it_behaves_like 'uploads migration worker'
end
end
......@@ -191,17 +191,4 @@ describe PostReceive do
end
end
end
describe 'processing design changes' do
let(:gl_repository) { "design-#{project.id}" }
it 'does not do anything' do
worker = described_class.new
expect(worker).not_to receive(:process_wiki_changes)
expect(worker).not_to receive(:process_project_changes)
described_class.new.perform(gl_repository, key_id, base64_changes)
end
end
end
......@@ -342,3 +342,19 @@ describe PersonalSnippet, 'Mentionable' do
end
end
end
describe DesignManagement::Design do
describe '#store_mentions!' do
it_behaves_like 'mentions in notes', :design do
let(:note) { create(:diff_note_on_design) }
let(:mentionable) { note.noteable }
end
end
describe 'load mentions' do
it_behaves_like 'load mentions from DB', :design do
let(:note) { create(:diff_note_on_design) }
let(:mentionable) { note.noteable }
end
end
end
......@@ -2876,7 +2876,7 @@ describe Repository do
end
describe '#lfs_enabled?' do
let_it_be(:project) { create(:project, :repository, lfs_enabled: true) }
let_it_be(:project) { create(:project, :repository, :design_repo, lfs_enabled: true) }
subject { repository.lfs_enabled? }
......@@ -2933,5 +2933,21 @@ describe Repository do
is_expected.to be_falsy
end
end
context 'for a design repository' do
let(:repository) { project.design_repository }
it 'returns true when LFS is enabled' do
stub_lfs_setting(enabled: true)
is_expected.to be_truthy
end
it 'returns false when LFS is disabled' do
stub_lfs_setting(enabled: false)
is_expected.to be_falsy
end
end
end
end
......@@ -119,4 +119,16 @@ describe 'gitlab:uploads:migrate and migrate_to_local rake tasks' do
it_behaves_like 'enqueue upload migration jobs in batch', batch: 4
end
context 'for DesignManagement::DesignV432x230Uploader' do
let(:uploader_class) { DesignManagement::DesignV432x230Uploader }
let(:model_class) { DesignManagement::Action }
let(:mounted_as) { :image_v432x230 }
before do
create_list(:design_action, 10, :with_image_v432x230)
end
it_behaves_like 'enqueue upload migration jobs in batch', batch: 4
end
end
......@@ -65,4 +65,16 @@ describe ObjectStorage::MigrateUploadsWorker do
end
end
end
context 'for DesignManagement::DesignV432x230Uploader' do
let(:model_class) { DesignManagement::Action }
let!(:design_actions) { create_list(:design_action, 10, :with_image_v432x230) }
let(:mounted_as) { :image_v432x230 }
before do
stub_uploads_object_storage(DesignManagement::DesignV432x230Uploader)
end
it_behaves_like 'uploads migration worker'
end
end
......@@ -471,4 +471,17 @@ describe PostReceive do
it_behaves_like 'snippet changes actions'
end
end
describe 'processing design changes' do
let(:gl_repository) { "design-#{project.id}" }
it 'does not do anything' do
worker = described_class.new
expect(worker).not_to receive(:process_wiki_changes)
expect(worker).not_to receive(:process_project_changes)
described_class.new.perform(gl_repository, key_id, base64_changes)
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment