From 1db4c2d1a0de05099e9e973288eb204bd5fb54c5 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 25 Oct 2017 14:39:49 +1100 Subject: [PATCH] moving redis to readonly mode destablizes the test suite --- spec/models/application_request_spec.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/spec/models/application_request_spec.rb b/spec/models/application_request_spec.rb index ed54d743871..59d9490a955 100644 --- a/spec/models/application_request_spec.rb +++ b/spec/models/application_request_spec.rb @@ -20,23 +20,21 @@ describe ApplicationRequest do end context "readonly test" do - after do - $redis.slaveof("no", "one") - end - it 'works even if redis is in readonly' do disable_date_flush! inc(:http_total) inc(:http_total) - $redis.slaveof("127.0.0.1", 666) + $redis.without_namespace.stubs(:incr).raises(Redis::CommandError.new("READONLY")) + $redis.without_namespace.stubs(:eval).raises(Redis::CommandError.new("READONLY")) # flush will be deferred no error raised inc(:http_total, autoflush: 3) ApplicationRequest.write_cache! - $redis.slaveof("no", "one") + $redis.without_namespace.unstub(:incr) + $redis.without_namespace.unstub(:eval) inc(:http_total, autoflush: 3) expect(ApplicationRequest.http_total.first.count).to eq(3)