Permalink
Browse files

Expose version number with 'version' property

  • Loading branch information...
1 parent 03e7f29 commit a28e96900df6ee371e012fae4ac384c1f10ab39a @andris9 committed Dec 1, 2013
Showing with 12 additions and 1 deletion.
  1. +4 −1 lib/mailer.js
  2. +8 −0 tests/mailer.js
View
5 lib/mailer.js
@@ -5,10 +5,13 @@ var createQueue = require("./queue"),
dns = require("dns"),
net = require("net"),
os = require("os"),
+ packageData = require("../package.json"),
EventEmitter = require("events").EventEmitter;
module.exports = function(options){
- return new DirectMailer(options);
+ var mailer = new DirectMailer(options);
+ mailer.version = packageData.version;
+ return mailer;
};
/**
View
8 tests/mailer.js
@@ -2,6 +2,7 @@
var simplesmtp = require("simplesmtp"),
createDirectmailer = require("../index"),
+ packageData = require("../package.json"),
PORT_NUMBER = 8397;
exports["General tests"] = {
@@ -29,6 +30,13 @@ exports["General tests"] = {
test.done();
},
+ "Mailer instance exposes version number": function(test){
+ var mailer = createDirectmailer();
+ test.ok(mailer.version);
+ test.equal(mailer.version, packageData.version);
+ test.done();
+ },
+
"Send mail": function(test){
var mailer = createDirectmailer({
debug: false,

0 comments on commit a28e969

Please sign in to comment.