mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
I committed a regression around multi site today and site customization, added tests so it don't happen again
This commit is contained in:
@@ -16,6 +16,35 @@ describe SiteCustomization do
|
||||
end
|
||||
|
||||
context 'caching' do
|
||||
|
||||
context 'enabled style' do
|
||||
before do
|
||||
@customization = customization
|
||||
end
|
||||
|
||||
it 'finds no style when none enabled' do
|
||||
SiteCustomization.enabled_style_key.should be_nil
|
||||
end
|
||||
|
||||
it 'finds the enabled style' do
|
||||
@customization.enabled = true
|
||||
@customization.save
|
||||
SiteCustomization.enabled_style_key.should == @customization.key
|
||||
end
|
||||
|
||||
it 'finds no enabled style on other sites' do
|
||||
@customization.enabled = true
|
||||
@customization.save
|
||||
|
||||
RailsMultisite::ConnectionManagement.expects(:current_db).returns("foo").twice
|
||||
# the mocking is tricky, lets remove the record so we can properly pretend we are on another db
|
||||
# this bypasses the before / after stuff
|
||||
SiteCustomization.exec_sql('delete from site_customizations')
|
||||
|
||||
SiteCustomization.enabled_style_key.should be_nil
|
||||
end
|
||||
end
|
||||
|
||||
it 'should allow me to lookup a filename containing my preview stylesheet' do
|
||||
SiteCustomization.custom_stylesheet(customization.key).should ==
|
||||
"<link class=\"custom-css\" rel=\"stylesheet\" href=\"/stylesheet-cache/#{customization.key}.css?#{customization.stylesheet_hash}\" type=\"text/css\" media=\"screen\">"
|
||||
|
||||
Reference in New Issue
Block a user