diff --git a/spec/components/file_store/local_store_spec.rb b/spec/components/file_store/local_store_spec.rb index 2ef9097a5c8..28f741f1aab 100644 --- a/spec/components/file_store/local_store_spec.rb +++ b/spec/components/file_store/local_store_spec.rb @@ -84,12 +84,22 @@ describe FileStore::LocalStore do end + def stub_for_subfolder + GlobalSetting.stubs(:relative_url_root).returns('/forum') + Discourse.stubs(:base_uri).returns("/forum") + end + describe ".absolute_base_url" do it "is present" do expect(store.absolute_base_url).to eq("http://test.localhost/uploads/default") end + it "supports subfolder" do + stub_for_subfolder + expect(store.absolute_base_url).to eq("http://test.localhost/forum/uploads/default") + end + end describe ".relative_base_url" do @@ -98,6 +108,11 @@ describe FileStore::LocalStore do expect(store.relative_base_url).to eq("/uploads/default") end + it "supports subfolder" do + stub_for_subfolder + expect(store.relative_base_url).to eq("/forum/uploads/default") + end + end it "is internal" do