diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4cefbe39957..1ee2f33727a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -281,7 +281,13 @@ module ApplicationHelper end def application_logo_url - @application_logo_url ||= (mobile_view? && SiteSetting.site_mobile_logo_url).presence || SiteSetting.site_logo_url + @application_logo_url ||= begin + if mobile_view? && SiteSetting.site_mobile_logo_url + SiteSetting.site_mobile_logo_url + else + SiteSetting.site_home_logo_url + end + end end def login_path diff --git a/spec/requests/exceptions_controller_spec.rb b/spec/requests/exceptions_controller_spec.rb new file mode 100644 index 00000000000..3ede1182efb --- /dev/null +++ b/spec/requests/exceptions_controller_spec.rb @@ -0,0 +1,37 @@ +require 'rails_helper' + +RSpec.describe ExceptionsController do + describe "#not_found" do + it "should return the right response" do + get "/404" + + expect(response.status).to eq(404) + + expect(response.body).to have_tag( + "img", + with: { + src: SiteSetting.site_home_logo_url + } + ) + end + + describe "text site logo" do + let(:title) { "some awesome title" } + + before do + SiteSetting.title = title + end + + it "should return the right response" do + get "/404" + + expect(response.status).to eq(404) + + expect(response.body).to have_tag( + "h2", + text: title + ) + end + end + end +end