Skip to content

Commit

Permalink
use fake redis properly when preparing test servers
Browse files Browse the repository at this point in the history
  • Loading branch information
evantahler committed Mar 11, 2013
1 parent c0b8608 commit 5f0c343
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions helpers/specHelper.js
Expand Up @@ -131,20 +131,28 @@ specHelper.clearRedis = function(serverID, next){
if(serverID != 0){ if(serverID != 0){
next(); next();
}else{ }else{
var redis = require('redis'); if(toFakeRedis){
var client = redis.createClient(redisConfig.port, redisConfig.host, redisConfig.options); var redis = require('fakeredis');
client.on("ready", function (err) { var client = redis.createClient(redisConfig.port, redisConfig.host, redisConfig.options);
client.select(redisConfig.DB, function(){ redis.fast = true;
client.flushdb(function(){
next();
});
}else{
var redis = require('redis');
var client = redis.createClient(redisConfig.port, redisConfig.host, redisConfig.options);
client.on("ready", function (err) {
client.select(redisConfig.DB, function(){
client.flushdb(function(){ client.flushdb(function(){
// process.stdout.write("[ test redis emptied ] ");
next(); next();
}); });
});
}); });
}); client.on("error", function (err) {
client.on("error", function (err) { process.stdout.write("\r\n\r\n!! Redis Error: " + err + "\r\n\r\n");
process.stdout.write("\r\n\r\n!! Redis Error: " + err + "\r\n\r\n"); process.exit(); // redis is really important...
process.exit(); // redis is really important... });
}); }
} }
} }


Expand Down

0 comments on commit 5f0c343

Please sign in to comment.