A platform for community discussion. Free, open, simple.
DEV: Fix another frozen string error.
Guo Xiang Tane2444e0d3158
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rbindex 152bebae7dd..892380ab198 100644--- a/app/controllers/application_controller.rb+++ b/app/controllers/application_controller.rb@@ -775,8 +775,7 @@ class ApplicationController < ActionController::Baseend@container_class = "wrap not-found-container"- @slug = params[:slug].presence || params[:id].presence || ""- @slug.tr!('-', ' ')+ @slug = (params[:slug].presence || params[:id].presence || "").tr('-', '')@hide_search = true if SiteSetting.login_requiredrender_to_string status: status, layout: layout, formats: [:html], template: '/exceptions/not_found'enddiff --git a/spec/requests/application_controller_spec.rb b/spec/requests/application_controller_spec.rbindex 531a86cf71c..4a40d717937 100644--- a/spec/requests/application_controller_spec.rb+++ b/spec/requests/application_controller_spec.rb@@ -189,10 +189,15 @@ RSpec.describe ApplicationController doexpect(response).to redirect_to("/forum/t/#{new_topic.slug}/#{new_topic.id}/#{new_topic.posts.last.post_number}")end- it 'should return 404 and show Google search' do+ it 'should return 404 and show Google search for an invalid topic route' doget "/t/nope-nope/99999999"+expect(response.status).to eq(404)- expect(response.body).to include(I18n.t('page_not_found.search_button'))++ response_body = response.body++ expect(response_body).to include(I18n.t('page_not_found.search_button'))+ expect(response_body).to have_tag("input", with: { value: 'nopenope' })endit 'should not include Google search if login_required is enabled' dodiff --git a/spec/requests/posts_controller_spec.rb b/spec/requests/posts_controller_spec.rbindex dea1680497e..8044572b684 100644--- a/spec/requests/posts_controller_spec.rb+++ b/spec/requests/posts_controller_spec.rb@@ -1648,6 +1648,20 @@ describe PostsController dodescribe '#latest' docontext 'private posts' do+ describe 'when not logged in' do+ it 'should return the right response' do+ Fabricate(:post)++ get "/private-posts.rss"++ expect(response.status).to eq(404)++ expect(response.body).to have_tag(+ "input", with: { value: "private_posts" }+ )+ end+ end+it 'returns private posts rss feed' dosign_in(admin)