From c72363ebd738e3028df355a979e7374c445eb6bf Mon Sep 17 00:00:00 2001 From: Rafael dos Santos Silva Date: Thu, 10 Mar 2016 00:48:50 -0300 Subject: [PATCH] Adds large image upload on subfolder install spec --- spec/components/cooked_post_processor_spec.rb | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/spec/components/cooked_post_processor_spec.rb b/spec/components/cooked_post_processor_spec.rb index 89d0c51e0a1..d730ac92b11 100644 --- a/spec/components/cooked_post_processor_spec.rb +++ b/spec/components/cooked_post_processor_spec.rb @@ -128,6 +128,39 @@ describe CookedPostProcessor do end + context "with large images when using subfolders" do + + let(:subfolder_upload) { Fabricate(:subfolder_upload) } + let(:post) { Fabricate(:post_with_large_image_on_subfolder) } + let(:cpp) { CookedPostProcessor.new(post) } + let(:base_url) { "http://test.localhost/subfolder" } + let(:base_uri) { "/subfolder" } + + before do + SiteSetting.max_image_height = 2000 + SiteSetting.create_thumbnails = true + Discourse.stubs(:base_url).returns(base_url) + Discourse.stubs(:base_uri).returns(base_uri) + + Upload.expects(:get_from_url).returns(subfolder_upload) + FastImage.stubs(:size).returns([1000, 2000]) + + # hmmm this should be done in a cleaner way + OptimizedImage.expects(:resize).returns(true) + + FileStore::BaseStore.any_instance.expects(:get_depth_for).returns(0) + end + + it "generates overlay information" do + cpp.post_process_images + expect(cpp.html).to match_html '

' + expect(cpp).to be_dirty + end + + end + context "with title" do let(:upload) { Fabricate(:upload) }