Skip to content
Snippets Groups Projects
Commit abc82a25 authored by Toon Claes's avatar Toon Claes
Browse files

Fix ProjectCacheWorker for plain READMEs

The ProjectCacheWorker refreshes cache periodically, but it runs outside Rails
context. So include the ActionView helpers so the `content_tag` method is
available.
parent e4eec191
No related branches found
No related tags found
2 merge requests!12073Add RC2 changes to 9-3-stable,!11506Fix ProjectCacheWorker for plain READMEs
Pipeline #
require 'nokogiri'
 
module MarkupHelper
include ActionView::Helpers::TagHelper
include ActionView::Context
def plain?(filename)
Gitlab::MarkupHelper.plain?(filename)
end
Loading
Loading
Loading
Loading
@@ -45,6 +45,18 @@ describe ProjectCacheWorker do
 
worker.perform(project.id, %w(readme))
end
context 'with plain readme' do
it 'refreshes the method caches' do
allow(MarkupHelper).to receive(:gitlab_markdown?).and_return(false)
allow(MarkupHelper).to receive(:plain?).and_return(true)
expect_any_instance_of(Repository).to receive(:refresh_method_caches).
with(%i(readme)).
and_call_original
worker.perform(project.id, %w(readme))
end
end
end
end
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment