Skip to content

Commit

Permalink
Make the deleting of the blob consistent
Browse files Browse the repository at this point in the history
Deleting blobs linked to sample types is done in the same manner as the
blobs linked to other assets.
  • Loading branch information
kdp-cloud committed Oct 2, 2024
1 parent a7f8449 commit e824fcf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/seek/acts_as_asset/content_blobs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module ContentBlobs
module ClassMethods
extend ActiveSupport::Concern
included do
after_destroy :mark_deleted_content_blobs, unless: -> { self.class == SampleType }
after_destroy :mark_deleted_content_blobs
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/seek/templates/sample_type_template_concerns.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module SampleTypeTemplateConcerns
included do
after_save :queue_template_generation, :queue_sample_type_update_job
validate :validate_template_file
has_one :content_blob, as: :asset, dependent: :destroy
has_one :content_blob, as: :asset
alias_method :template, :content_blob
has_task :template_generation
extend ClassMethods
Expand Down
10 changes: 5 additions & 5 deletions test/unit/sample_type_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -454,13 +454,13 @@ def setup
sample_type.save!
blob = sample_type.content_blob

assert_difference('ContentBlob.count', -1) do
assert_difference('SampleType.count', -1) do
sample_type.destroy
end
refute blob.deleted?

assert_difference('SampleType.count', -1) do
sample_type.destroy
end

assert blob.destroyed?
assert blob.deleted?
end
end
end
Expand Down

0 comments on commit e824fcf

Please sign in to comment.