summaryrefslogtreecommitdiff
path: root/spec/models/upload_spec.rb
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2018-02-06 15:19:35 +0000
committerSean McGivern <sean@mcgivern.me.uk>2018-02-06 15:19:35 +0000
commit9ab4c5b735e0e121996b092cb20bcdc423045c5e (patch)
tree981ea32cf01d5261e9956439ce9745c5e2ae6dcf /spec/models/upload_spec.rb
parent86342966a1b61d30dca019e983235aadc14a36ef (diff)
parent939391af7bc471f1588ab75ab0cf08d8e4286a05 (diff)
downloadgitlab-ce-9ab4c5b735e0e121996b092cb20bcdc423045c5e.tar.gz
Merge branch '14256-upload-destroy-removes-file' into 'master'
Uploads should delete files when destroyed Closes #14256 See merge request gitlab-org/gitlab-ce!16799
Diffstat (limited to 'spec/models/upload_spec.rb')
-rw-r--r--spec/models/upload_spec.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/models/upload_spec.rb b/spec/models/upload_spec.rb
index 0dcaa026332..36b8e5d304f 100644
--- a/spec/models/upload_spec.rb
+++ b/spec/models/upload_spec.rb
@@ -43,6 +43,18 @@ describe Upload do
.to(a_string_matching(/\A\h{64}\z/))
end
end
+
+ describe 'after_destroy' do
+ context 'uploader is FileUploader-based' do
+ subject { create(:upload, :issuable_upload) }
+
+ it 'calls delete_file!' do
+ is_expected.to receive(:delete_file!)
+
+ subject.destroy
+ end
+ end
+ end
end
describe '#absolute_path' do