mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 00:00:46 +08:00
DEV: improve usability of subfolder specs
Previously people were not consistent about mocking which left internals in a fragile state when running subfolder specs. This introduces a simple helper `set_subfolder` which you can use to set the subfolder for the spec. It takes care of proper configuration of subfolder and teardown. ``` # usage set_subfolder "/my_amazing_subfolder" ``` You should no longer stub base_uri or global_settings
This commit is contained in:
@ -558,14 +558,12 @@ describe CookedPostProcessor do
|
||||
end
|
||||
|
||||
let(:cpp) { CookedPostProcessor.new(post, disable_loading_image: true) }
|
||||
let(:base_url) { "http://test.localhost/subfolder" }
|
||||
let(:base_uri) { "/subfolder" }
|
||||
|
||||
before do
|
||||
set_subfolder "/subfolder"
|
||||
|
||||
SiteSetting.max_image_height = 2000
|
||||
SiteSetting.create_thumbnails = true
|
||||
Discourse.stubs(:base_url).returns(base_url)
|
||||
Discourse.stubs(:base_uri).returns(base_uri)
|
||||
FastImage.expects(:size).returns([1750, 2000])
|
||||
OptimizedImage.expects(:resize).returns(true)
|
||||
|
||||
|
Reference in New Issue
Block a user