Skip to content

Commit

Permalink
better fix for unset properties in tests
Browse files Browse the repository at this point in the history
will remove a bunch of boilerplate from test setups
  • Loading branch information
msimerson committed Feb 6, 2017
1 parent 4967493 commit b4a0be8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Changes.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

# 1.0.2 - 2017-02-06
# 1.0.3 - 2017-02-06

- don't break when no [redis] config exists
8 changes: 6 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,13 @@ exports.init_redis_plugin = function (next, server) {
next();
}

// tests that do not load config
if (!plugin.cfg) plugin.cfg = { redis: {} };
if (!server) server = { notes: {} };

// use server-wide redis connection when using default DB id
if (!plugin.cfg.redis || !plugin.cfg.redis.db) {
if (server && server.notes && server.notes.redis) {
if (!plugin.cfg.redis.db) {
if (server.notes.redis) {
server.loginfo(plugin, 'using server.notes.redis');
plugin.db = server.notes.redis;
return nextOnce();
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "haraka-plugin-redis",
"version": "1.0.2",
"description": "Redis plugin for Haraka & other plugins",
"version": "1.0.3",
"description": "Redis plugin for Haraka & other plugins to inherit from",
"main": "index.js",
"directories": {
"test": "test"
Expand Down

0 comments on commit b4a0be8

Please sign in to comment.