diff options
-rw-r--r-- | app/helpers/markup_helper.rb | 3 | ||||
-rw-r--r-- | spec/workers/project_cache_worker_spec.rb | 12 |
2 files changed, 15 insertions, 0 deletions
diff --git a/app/helpers/markup_helper.rb b/app/helpers/markup_helper.rb index 0009cad86c4..941cfce8370 100644 --- a/app/helpers/markup_helper.rb +++ b/app/helpers/markup_helper.rb @@ -1,6 +1,9 @@ require 'nokogiri' module MarkupHelper + include ActionView::Helpers::TagHelper + include ActionView::Context + def plain?(filename) Gitlab::MarkupHelper.plain?(filename) end diff --git a/spec/workers/project_cache_worker_spec.rb b/spec/workers/project_cache_worker_spec.rb index c23ffdf99c0..a4ba5f7c943 100644 --- a/spec/workers/project_cache_worker_spec.rb +++ b/spec/workers/project_cache_worker_spec.rb @@ -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 |