Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: matflores/redis-rb
...
head fork: matflores/redis-rb
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 2 contributors
View
26 test/distributed_persistence_control_commands_test.rb
@@ -1,23 +1,37 @@
# encoding: UTF-8
require File.expand_path("./helper", File.dirname(__FILE__))
+require File.expand_path("./redis_mock", File.dirname(__FILE__))
+
require "redis/distributed"
+include RedisMock::Helper
+
setup do
log = StringIO.new
init Redis::Distributed.new(NODES, :logger => ::Logger.new(log))
end
-test "SAVE and BGSAVE" do |r|
- assert_nothing_raised do
- r.save
+test "SAVE" do
+ redis_mock(:save => lambda { "+SAVE" }) do
+ redis = Redis.new(OPTIONS.merge(:port => 6380))
+
+ assert "SAVE" == redis.save
end
+end
- assert_nothing_raised do
- r.bgsave
+test "BGSAVE" do
+ redis_mock(:bgsave => lambda { "+BGSAVE" }) do
+ redis = Redis.new(OPTIONS.merge(:port => 6380))
+
+ assert "BGSAVE" == redis.bgsave
end
end
test "LASTSAVE" do |r|
- assert r.lastsave.all? { |t| Time.at(t) <= Time.now }
+ redis_mock(:lastsave => lambda { "+LASTSAVE" }) do
+ redis = Redis.new(OPTIONS.merge(:port => 6380))
+
+ assert "LASTSAVE" == redis.lastsave
+ end
end
View
25 test/persistence_control_commands_test.rb
@@ -1,21 +1,34 @@
# encoding: UTF-8
require File.expand_path("./helper", File.dirname(__FILE__))
+require File.expand_path("./redis_mock", File.dirname(__FILE__))
+
+include RedisMock::Helper
setup do
init Redis.new(OPTIONS)
end
-test "SAVE and BGSAVE" do |r|
- assert_nothing_raised do
- r.save
+test "SAVE" do
+ redis_mock(:save => lambda { "+SAVE" }) do
+ redis = Redis.new(OPTIONS.merge(:port => 6380))
+
+ assert "SAVE" == redis.save
end
+end
- assert_nothing_raised do
- r.bgsave
+test "BGSAVE" do
+ redis_mock(:bgsave => lambda { "+BGSAVE" }) do
+ redis = Redis.new(OPTIONS.merge(:port => 6380))
+
+ assert "BGSAVE" == redis.bgsave
end
end
test "LASTSAVE" do |r|
- assert Time.at(r.lastsave) <= Time.now
+ redis_mock(:lastsave => lambda { "+LASTSAVE" }) do
+ redis = Redis.new(OPTIONS.merge(:port => 6380))
+
+ assert "LASTSAVE" == redis.lastsave
+ end
end

No commit comments for this range

Something went wrong with that request. Please try again.