Permalink
Browse files

Add remove service spec and implementation.

  • Loading branch information...
1 parent 2d6d023 commit 635d51a4e4e04b8eed38de9573d5bf2a3dd75977 @llun committed Feb 28, 2013
Showing with 30 additions and 4 deletions.
  1. +0 −4 routes/services.js
  2. +8 −0 services/index.js
  3. +4 −0 spec/test_routes_services.js
  4. +18 −0 spec/test_services.js
View
@@ -32,10 +32,6 @@ module.exports = {
.done();
},
- list: function (req, res) {
-
- },
-
remove: function (req, res) {
}
View
@@ -75,4 +75,12 @@ Service.save = function (name, token, cb) {
}
+Service.remove = function (name, cb) {
+ var parameters = util.parameters(arguments);
+
+ Model.remove({ name: parameters.name }, function (err) {
+ cb(err);
+ });
+}
+
module.exports = Service;
@@ -90,5 +90,9 @@ describe('routes/services.js', function () {
});
+ describe('#remove', function () {
+
+ });
+
});
View
@@ -107,5 +107,23 @@ describe('Services', function () {
});
+ describe('#remove', function () {
+
+ var stub = sinon.stub(Model, 'remove').callsArgWith(1);
+
+ it ('should remove service with name', function (done) {
+
+ Services.remove('facebook', function (err) {
+ var arguments = stub.args[0][0];
+ arguments.name.should.equal('facebook');
+
+ stub.restore();
+ done();
+ });
+
+ });
+
+ });
+
});

0 comments on commit 635d51a

Please sign in to comment.