gitlab-org--gitlab-foss/spec/models/appearance_spec.rb
Jan Provaznik 239fdc78b1 Use FastDestroy for deleting uploads
It gathers list of file paths to delete before destroying
the parent object. Then after the parent_object is destroyed
these paths are scheduled for deletion asynchronously.

Carrierwave needed associated model for deleting upload file.
To avoid this requirement, simple Fog/File layer is used directly
for file deletion, this allows us to use just a simple list of paths.
2018-12-06 22:00:19 +01:00

29 lines
728 B
Ruby

require 'rails_helper'
describe Appearance do
subject { build(:appearance) }
it { include(CacheableAttributes) }
it { expect(described_class.current_without_cache).to eq(described_class.first) }
it { is_expected.to have_many(:uploads) }
describe '#single_appearance_row' do
it 'adds an error when more than 1 row exists' do
create(:appearance)
new_row = build(:appearance)
new_row.save
expect(new_row.valid?).to eq(false)
end
end
context 'with uploads' do
it_behaves_like 'model with uploads', false do
let(:model_object) { create(:appearance, :with_logo) }
let(:upload_attribute) { :logo }
let(:uploader_class) { AttachmentUploader }
end
end
end