summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2017-05-18 21:06:38 +0200
committerToon Claes <toon@gitlab.com>2017-05-18 21:10:10 +0200
commitabc82a2508d102bb30789bce4a8b4ba56011683a (patch)
treeaf215f5f11b6f229bce87fff52353a748b07ddd3 /spec
parente4eec191565a053f687911d80865ad43241453f8 (diff)
downloadgitlab-ce-abc82a2508d102bb30789bce4a8b4ba56011683a.tar.gz
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.
Diffstat (limited to 'spec')
-rw-r--r--spec/workers/project_cache_worker_spec.rb12
1 files changed, 12 insertions, 0 deletions
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