Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2016-08-10 00:08:33 +0300
committerStan Hu <stanhu@gmail.com>2016-08-10 02:08:03 +0300
commit1e6316172b913b622379675d3d48e6837dfc1843 (patch)
treebc0af07068269589e99bc4a0f38f07c12703c7fd /spec/spec_helper.rb
parent936729e5be97d88fbc927ede20ec1d4cf5fe6daa (diff)
Add a method in Project to return a cached value of total count of projects
This is in preparation to address the DB load caused by the counting in gitlab-com/infrastructure#303.
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r--spec/spec_helper.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 4f3aacf55be..2e2aa7c4fc0 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -42,6 +42,13 @@ RSpec.configure do |config|
config.before(:suite) do
TestEnv.init
end
+
+ config.around(:each, :caching) do |example|
+ caching_store = Rails.cache
+ Rails.cache = ActiveSupport::Cache::MemoryStore.new if example.metadata[:caching]
+ example.run
+ Rails.cache = caching_store
+ end
end
FactoryGirl::SyntaxRunner.class_eval do