Skip to content
Browse files

Merge pull request #197 from matflores/test_saving_with_mock_server

Test saving with mock server
  • Loading branch information...
2 parents a00e80e + a2e4ed3 commit 38e3f00728f1309c66f5ea876658b8f4e590651d @pietern pietern committed Mar 14, 2012
Showing with 8 additions and 15 deletions.
  1. +7 −10 test/distributed_persistence_control_commands_test.rb
  2. +1 −5 test/persistence_control_commands_test.rb
View
17 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
View
6 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))

0 comments on commit 38e3f00

Please sign in to comment.
Something went wrong with that request. Please try again.