OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
test both local and remote attachment cases
Markus Kahld19d2623c03a
diff --git a/spec/models/attachment_spec.rb b/spec/models/attachment_spec.rbindex 6f058df551c..30c678d06f7 100644--- a/spec/models/attachment_spec.rb+++ b/spec/models/attachment_spec.rb@@ -244,12 +244,27 @@ describe Attachment, type: :model doendend+ shared_examples "it uses content disposition inline" do+ let(:attachment) { raise "define me!" }++ describe 'the external url (for remote attachments)' do+ it 'contains inline content disposition without the filename' do+ expect(attachment.external_url.to_s).to include "response-content-disposition=inline&"+ end+ end++ describe 'content disposition (for local attachments)' do+ it 'is inline, including the filename' do+ expect(attachment.content_disposition).to eq "inline; filename=#{attachment.filename}"+ end+ end+ end+describe "for an image file" dobefore { image_attachment.save! }- it "should make S3 use content_disposition inline" do- expect(image_attachment.content_disposition).to eq "inline; filename=image.png"- expect(image_attachment.external_url.to_s).to include "response-content-disposition=inline"+ it_behaves_like "it uses content disposition inline" do+ let(:attachment) { image_attachment }end# this is independent from the type of file uploaded so we just test this for the first one@@ -261,9 +276,8 @@ describe Attachment, type: :model dodescribe "for a text file" dobefore { text_attachment.save! }- it "should make S3 use content_disposition inline" do- expect(text_attachment.content_disposition).to eq "inline; filename=testfile.txt"- expect(text_attachment.external_url.to_s).to include "response-content-disposition=inline"+ it_behaves_like "it uses content disposition inline" do+ let(:attachment) { text_attachment }endend