mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 13:51:09 +08:00
Nuke all SiteSetting.stubs
from our codebase.
This commit is contained in:
@ -298,21 +298,21 @@ describe CookedPostProcessor do
|
||||
|
||||
it "resizes when only width is specified" do
|
||||
img = { 'src' => 'http://foo.bar/image3.png', 'width' => 100}
|
||||
SiteSetting.stubs(:crawl_images?).returns(true)
|
||||
SiteSetting.crawl_images = true
|
||||
FastImage.expects(:size).returns([200, 400])
|
||||
expect(cpp.get_size_from_attributes(img)).to eq([100, 200])
|
||||
end
|
||||
|
||||
it "resizes when only height is specified" do
|
||||
img = { 'src' => 'http://foo.bar/image3.png', 'height' => 100}
|
||||
SiteSetting.stubs(:crawl_images?).returns(true)
|
||||
SiteSetting.crawl_images = true
|
||||
FastImage.expects(:size).returns([100, 300])
|
||||
expect(cpp.get_size_from_attributes(img)).to eq([33, 100])
|
||||
end
|
||||
|
||||
it "doesn't raise an error with a weird url" do
|
||||
img = { 'src' => nil, 'height' => 100}
|
||||
SiteSetting.stubs(:crawl_images?).returns(true)
|
||||
SiteSetting.crawl_images = true
|
||||
expect(cpp.get_size_from_attributes(img)).to be_nil
|
||||
end
|
||||
|
||||
@ -346,7 +346,7 @@ describe CookedPostProcessor do
|
||||
end
|
||||
|
||||
it "caches the results" do
|
||||
SiteSetting.stubs(:crawl_images?).returns(true)
|
||||
SiteSetting.crawl_images = true
|
||||
FastImage.expects(:size).returns([200, 400])
|
||||
cpp.get_size("http://foo.bar/image3.png")
|
||||
expect(cpp.get_size("http://foo.bar/image3.png")).to eq([200, 400])
|
||||
@ -354,7 +354,9 @@ describe CookedPostProcessor do
|
||||
|
||||
context "when crawl_images is disabled" do
|
||||
|
||||
before { SiteSetting.stubs(:crawl_images?).returns(false) }
|
||||
before do
|
||||
SiteSetting.crawl_images = false
|
||||
end
|
||||
|
||||
it "doesn't call FastImage" do
|
||||
FastImage.expects(:size).never
|
||||
@ -525,14 +527,15 @@ describe CookedPostProcessor do
|
||||
before { cpp.stubs(:available_disk_space).returns(90) }
|
||||
|
||||
it "does not run when download_remote_images_to_local is disabled" do
|
||||
SiteSetting.stubs(:download_remote_images_to_local).returns(false)
|
||||
SiteSetting.download_remote_images_to_local = false
|
||||
Jobs.expects(:cancel_scheduled_job).never
|
||||
cpp.pull_hotlinked_images
|
||||
end
|
||||
|
||||
context "when download_remote_images_to_local? is enabled" do
|
||||
|
||||
before { SiteSetting.stubs(:download_remote_images_to_local).returns(true) }
|
||||
before do
|
||||
SiteSetting.download_remote_images_to_local = true
|
||||
end
|
||||
|
||||
it "does not run when there is not enough disk space" do
|
||||
cpp.expects(:disable_if_low_on_disk_space).returns(true)
|
||||
|
Reference in New Issue
Block a user