about summary refs log tree commit diff
path: root/spec/services
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/after_block_service_spec.rb8
-rw-r--r--spec/services/batched_remove_status_service_spec.rb6
-rw-r--r--spec/services/fan_out_on_write_service_spec.rb22
-rw-r--r--spec/services/mute_service_spec.rb4
-rw-r--r--spec/services/precompute_feed_service_spec.rb4
5 files changed, 22 insertions, 22 deletions
diff --git a/spec/services/after_block_service_spec.rb b/spec/services/after_block_service_spec.rb
index c09425d7c..337766d06 100644
--- a/spec/services/after_block_service_spec.rb
+++ b/spec/services/after_block_service_spec.rb
@@ -14,7 +14,7 @@ RSpec.describe AfterBlockService, type: :service do
     let(:home_timeline_key) { FeedManager.instance.key(:home, account.id) }
 
     before do
-      Redis.current.del(home_timeline_key)
+      redis.del(home_timeline_key)
     end
 
     it "clears account's statuses" do
@@ -23,7 +23,7 @@ RSpec.describe AfterBlockService, type: :service do
       FeedManager.instance.push_to_home(account, other_account_reblog)
 
       expect { subject }.to change {
-        Redis.current.zrange(home_timeline_key, 0, -1)
+        redis.zrange(home_timeline_key, 0, -1)
       }.from([status.id.to_s, other_account_status.id.to_s, other_account_reblog.id.to_s]).to([other_account_status.id.to_s])
     end
   end
@@ -33,7 +33,7 @@ RSpec.describe AfterBlockService, type: :service do
     let(:list_timeline_key) { FeedManager.instance.key(:list, list.id) }
 
     before do
-      Redis.current.del(list_timeline_key)
+      redis.del(list_timeline_key)
     end
 
     it "clears account's statuses" do
@@ -42,7 +42,7 @@ RSpec.describe AfterBlockService, type: :service do
       FeedManager.instance.push_to_list(list, other_account_reblog)
 
       expect { subject }.to change {
-        Redis.current.zrange(list_timeline_key, 0, -1)
+        redis.zrange(list_timeline_key, 0, -1)
       }.from([status.id.to_s, other_account_status.id.to_s, other_account_reblog.id.to_s]).to([other_account_status.id.to_s])
     end
   end
diff --git a/spec/services/batched_remove_status_service_spec.rb b/spec/services/batched_remove_status_service_spec.rb
index 8f38908cd..920edeb13 100644
--- a/spec/services/batched_remove_status_service_spec.rb
+++ b/spec/services/batched_remove_status_service_spec.rb
@@ -12,7 +12,7 @@ RSpec.describe BatchedRemoveStatusService, type: :service do
   let(:status2) { PostStatusService.new.call(alice, text: 'Another status') }
 
   before do
-    allow(Redis.current).to receive_messages(publish: nil)
+    allow(redis).to receive_messages(publish: nil)
 
     stub_request(:post, 'http://example.com/inbox').to_return(status: 200)
 
@@ -40,11 +40,11 @@ RSpec.describe BatchedRemoveStatusService, type: :service do
   end
 
   it 'notifies streaming API of followers' do
-    expect(Redis.current).to have_received(:publish).with("timeline:#{jeff.id}", any_args).at_least(:once)
+    expect(redis).to have_received(:publish).with("timeline:#{jeff.id}", any_args).at_least(:once)
   end
 
   it 'notifies streaming API of public timeline' do
-    expect(Redis.current).to have_received(:publish).with('timeline:public', any_args).at_least(:once)
+    expect(redis).to have_received(:publish).with('timeline:public', any_args).at_least(:once)
   end
 
   it 'sends delete activity to followers' do
diff --git a/spec/services/fan_out_on_write_service_spec.rb b/spec/services/fan_out_on_write_service_spec.rb
index aaf179ce5..59e15d230 100644
--- a/spec/services/fan_out_on_write_service_spec.rb
+++ b/spec/services/fan_out_on_write_service_spec.rb
@@ -18,7 +18,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
     ProcessMentionsService.new.call(status)
     ProcessHashtagsService.new.call(status)
 
-    allow(Redis.current).to receive(:publish)
+    allow(redis).to receive(:publish)
 
     subject.call(status)
   end
@@ -40,13 +40,13 @@ RSpec.describe FanOutOnWriteService, type: :service do
     end
 
     it 'is broadcast to the hashtag stream' do
-      expect(Redis.current).to have_received(:publish).with('timeline:hashtag:hoge', anything)
-      expect(Redis.current).to have_received(:publish).with('timeline:hashtag:hoge:local', anything)
+      expect(redis).to have_received(:publish).with('timeline:hashtag:hoge', anything)
+      expect(redis).to have_received(:publish).with('timeline:hashtag:hoge:local', anything)
     end
 
     it 'is broadcast to the public stream' do
-      expect(Redis.current).to have_received(:publish).with('timeline:public', anything)
-      expect(Redis.current).to have_received(:publish).with('timeline:public:local', anything)
+      expect(redis).to have_received(:publish).with('timeline:public', anything)
+      expect(redis).to have_received(:publish).with('timeline:public:local', anything)
     end
   end
 
@@ -66,8 +66,8 @@ RSpec.describe FanOutOnWriteService, type: :service do
     end
 
     it 'is not broadcast publicly' do
-      expect(Redis.current).to_not have_received(:publish).with('timeline:hashtag:hoge', anything)
-      expect(Redis.current).to_not have_received(:publish).with('timeline:public', anything)
+      expect(redis).to_not have_received(:publish).with('timeline:hashtag:hoge', anything)
+      expect(redis).to_not have_received(:publish).with('timeline:public', anything)
     end
   end
 
@@ -84,8 +84,8 @@ RSpec.describe FanOutOnWriteService, type: :service do
     end
 
     it 'is not broadcast publicly' do
-      expect(Redis.current).to_not have_received(:publish).with('timeline:hashtag:hoge', anything)
-      expect(Redis.current).to_not have_received(:publish).with('timeline:public', anything)
+      expect(redis).to_not have_received(:publish).with('timeline:hashtag:hoge', anything)
+      expect(redis).to_not have_received(:publish).with('timeline:public', anything)
     end
   end
 
@@ -105,8 +105,8 @@ RSpec.describe FanOutOnWriteService, type: :service do
     end
 
     it 'is not broadcast publicly' do
-      expect(Redis.current).to_not have_received(:publish).with('timeline:hashtag:hoge', anything)
-      expect(Redis.current).to_not have_received(:publish).with('timeline:public', anything)
+      expect(redis).to_not have_received(:publish).with('timeline:hashtag:hoge', anything)
+      expect(redis).to_not have_received(:publish).with('timeline:public', anything)
     end
   end
 end
diff --git a/spec/services/mute_service_spec.rb b/spec/services/mute_service_spec.rb
index bdec1c67b..57d8c41de 100644
--- a/spec/services/mute_service_spec.rb
+++ b/spec/services/mute_service_spec.rb
@@ -12,7 +12,7 @@ RSpec.describe MuteService, type: :service do
     let(:home_timeline_key) { FeedManager.instance.key(:home, account.id) }
 
     before do
-      Redis.current.del(home_timeline_key)
+      redis.del(home_timeline_key)
     end
 
     it "clears account's statuses" do
@@ -20,7 +20,7 @@ RSpec.describe MuteService, type: :service do
       FeedManager.instance.push_to_home(account, other_account_status)
 
       expect { subject }.to change {
-        Redis.current.zrange(home_timeline_key, 0, -1)
+        redis.zrange(home_timeline_key, 0, -1)
       }.from([status.id.to_s, other_account_status.id.to_s]).to([other_account_status.id.to_s])
     end
   end
diff --git a/spec/services/precompute_feed_service_spec.rb b/spec/services/precompute_feed_service_spec.rb
index 1f6b6ed88..86b93b5d2 100644
--- a/spec/services/precompute_feed_service_spec.rb
+++ b/spec/services/precompute_feed_service_spec.rb
@@ -13,7 +13,7 @@ RSpec.describe PrecomputeFeedService, type: :service do
 
       subject.call(account)
 
-      expect(Redis.current.zscore(FeedManager.instance.key(:home, account.id), status.id)).to be_within(0.1).of(status.id.to_f)
+      expect(redis.zscore(FeedManager.instance.key(:home, account.id), status.id)).to be_within(0.1).of(status.id.to_f)
     end
 
     it 'does not raise an error even if it could not find any status' do
@@ -30,7 +30,7 @@ RSpec.describe PrecomputeFeedService, type: :service do
 
       subject.call(account)
 
-      expect(Redis.current.zscore(FeedManager.instance.key(:home, account.id), reblog.id)).to eq nil
+      expect(redis.zscore(FeedManager.instance.key(:home, account.id), reblog.id)).to eq nil
     end
   end
 end