From ad222dd392301b220c110842729473faf038a490 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mati=CC=81as=20Flores?= Date: Wed, 14 Mar 2012 16:15:19 -0300 Subject: [PATCH 1/2] Test SAVE, BGSAVE and LASTSAVE going through Redis::Distributed --- ...ributed_persistence_control_commands_test.rb | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/test/distributed_persistence_control_commands_test.rb b/test/distributed_persistence_control_commands_test.rb index 5f6457bad..106d21834 100644 --- a/test/distributed_persistence_control_commands_test.rb +++ b/test/distributed_persistence_control_commands_test.rb @@ -7,31 +7,28 @@ include RedisMock::Helper -setup do - log = StringIO.new - init Redis::Distributed.new(NODES, :logger => ::Logger.new(log)) -end +MOCK_NODES = ["redis://127.0.0.1:6380/15"] test "SAVE" do redis_mock(:save => lambda { "+SAVE" }) do - redis = Redis.new(OPTIONS.merge(:port => 6380)) + redis = Redis::Distributed.new(MOCK_NODES) - assert "SAVE" == redis.save + assert ["SAVE"] == redis.save end end test "BGSAVE" do redis_mock(:bgsave => lambda { "+BGSAVE" }) do - redis = Redis.new(OPTIONS.merge(:port => 6380)) + redis = Redis::Distributed.new(MOCK_NODES) - assert "BGSAVE" == redis.bgsave + assert ["BGSAVE"] == redis.bgsave end end test "LASTSAVE" do |r| redis_mock(:lastsave => lambda { "+LASTSAVE" }) do - redis = Redis.new(OPTIONS.merge(:port => 6380)) + redis = Redis::Distributed.new(MOCK_NODES) - assert "LASTSAVE" == redis.lastsave + assert ["LASTSAVE"] == redis.lastsave end end From a2e4ed364aa6a18714d4e0f679ed066c98d9deae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mati=CC=81as=20Flores?= Date: Wed, 14 Mar 2012 16:19:03 -0300 Subject: [PATCH 2/2] Clean persistence control tests --- test/persistence_control_commands_test.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/test/persistence_control_commands_test.rb b/test/persistence_control_commands_test.rb index 9694cb9c9..50310112e 100644 --- a/test/persistence_control_commands_test.rb +++ b/test/persistence_control_commands_test.rb @@ -5,10 +5,6 @@ include RedisMock::Helper -setup do - init Redis.new(OPTIONS) -end - test "SAVE" do redis_mock(:save => lambda { "+SAVE" }) do redis = Redis.new(OPTIONS.merge(:port => 6380)) @@ -25,7 +21,7 @@ end end -test "LASTSAVE" do |r| +test "LASTSAVE" do redis_mock(:lastsave => lambda { "+LASTSAVE" }) do redis = Redis.new(OPTIONS.merge(:port => 6380))