about summary refs log tree commit diff
path: root/spec/presenters/instance_presenter_spec.rb
diff options
context:
space:
mode:
authorAkihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>2018-02-18 06:35:05 +0900
committerEugen Rochko <eugen@zeonfederated.com>2018-02-17 22:35:05 +0100
commit9b8a4484778fb55bcb2526992807a51270229b72 (patch)
tree7dad9ae3df644227645b7607a97776e8602a56dc /spec/presenters/instance_presenter_spec.rb
parenta71af984011ff98df2fa1b7f6c983706a91d99bf (diff)
Isolate each specs for cache store (#6450)
The cache store is explicitly used by some specs, but they were not
isolated and therefore not reliable. This fixes the issue by clearing
the cache after each specs.
Diffstat (limited to 'spec/presenters/instance_presenter_spec.rb')
-rw-r--r--spec/presenters/instance_presenter_spec.rb12
1 files changed, 3 insertions, 9 deletions
diff --git a/spec/presenters/instance_presenter_spec.rb b/spec/presenters/instance_presenter_spec.rb
index 7c47aed61..006403925 100644
--- a/spec/presenters/instance_presenter_spec.rb
+++ b/spec/presenters/instance_presenter_spec.rb
@@ -90,9 +90,7 @@ describe InstancePresenter do
 
   describe "user_count" do
     it "returns the number of site users" do
-      cache = double
-      allow(Rails).to receive(:cache).and_return(cache)
-      allow(cache).to receive(:fetch).with("user_count").and_return(123)
+      Rails.cache.write 'user_count', 123
 
       expect(instance_presenter.user_count).to eq(123)
     end
@@ -100,9 +98,7 @@ describe InstancePresenter do
 
   describe "status_count" do
     it "returns the number of local statuses" do
-      cache = double
-      allow(Rails).to receive(:cache).and_return(cache)
-      allow(cache).to receive(:fetch).with("local_status_count").and_return(234)
+      Rails.cache.write 'local_status_count', 234
 
       expect(instance_presenter.status_count).to eq(234)
     end
@@ -110,9 +106,7 @@ describe InstancePresenter do
 
   describe "domain_count" do
     it "returns the number of known domains" do
-      cache = double
-      allow(Rails).to receive(:cache).and_return(cache)
-      allow(cache).to receive(:fetch).with("distinct_domain_count").and_return(345)
+      Rails.cache.write 'distinct_domain_count', 345
 
       expect(instance_presenter.domain_count).to eq(345)
     end