Permalink
Browse files

run specs with buster instead of the dead project 'jasmine-runner'

  • Loading branch information...
1 parent 2b1ab53 commit c8223b7a0873bc31daa34b1e328a4c11d38b0f68 @flosse flosse committed Aug 28, 2012
Showing with 58 additions and 51 deletions.
  1. +9 −4 rpc/README.md
  2. +11 −0 rpc/buster.js
  3. +0 −10 rpc/jasmine.json
  4. +33 −34 rpc/spec/strophe.rpc.spec.helper.js
  5. +5 −3 rpc/spec/strophe.rpc.spec.js
View
@@ -98,11 +98,16 @@ connection.rpc.addJidToWhiteList("*@*");
## Tests & specs
-I use the node module `jasmine-runner` for the tests. Install it and use it as follow :
+I use the node module `buster` for the tests. Install it and use it as follow :
```bash
-$ npm install jasmine-runner
-$ jasmine mon
+$ npm install buster
+$ buster server
```
-The tests run in the browser at the address `localhost:8124`.
+Open a browser and navigate to `http://localhost:1111` and capture the browser.
+Then you can run the tests:
+
+```
+$ buster test --browser
+```
View
@@ -0,0 +1,11 @@
+var config = module.exports;
+
+config["rpc"] = {
+ environment: "browser",
+ specs: ["spec/*.spec.js"],
+ sources: ["strophe.rpc.js"],
+ libs: [
+ "lib/strophe.js",
+ "spec/strophe.rpc.spec.helper.js"
+ ]
+};
View
@@ -1,10 +0,0 @@
-{
- "src_dir": "/",
- "spec_dir": "/spec/",
- "server": {
- "port": 8124
- },
- "externals": [
- "/lib/strophe.js"
- ]
-}
@@ -1,39 +1,38 @@
var helper = (function() {
- function receive(c,req) {
- c._dataRecv(createRequest(req));
- }
+ function receive(c,req) {
+ c._dataRecv(createRequest(req));
+ }
- function spyon (obj, method, cb) {
- spyOn(obj,method).andCallFake(function(res) {
- res = res;
- cb.call(this,res);
- });
- }
+ function spyon (obj, method, cb) {
+ sinon.stub(obj,method, function(res) {
+ cb.call(this,res);
+ });
+ }
- function mockConnection() {
- var c = new Strophe.Connection();
- c.authenticated = true;
- c.jid = 'n@d/r2';
- c._processRequest = function() {};
- c._changeConnectStatus(Strophe.Status.CONNECTED);
- return c;
- }
+ function mockConnection() {
+ var c = new Strophe.Connection();
+ c.authenticated = true;
+ c.jid = 'n@d/r2';
+ c._processRequest = function() {};
+ c._changeConnectStatus(Strophe.Status.CONNECTED);
+ return c;
+ }
- function createRequest(iq) {
- iq = typeof iq.tree == "function" ? iq.tree() : iq;
- var req = new Strophe.Request(iq, function() {});
- req.getResponse = function() {
- var env = new Strophe.Builder('env', {type: 'mock'}).tree();
- env.appendChild(iq);
- return env;
- };
- return req;
- }
+ function createRequest(iq) {
+ iq = typeof iq.tree == "function" ? iq.tree() : iq;
+ var req = new Strophe.Request(iq, function() {});
+ req.getResponse = function() {
+ var env = new Strophe.Builder('env', {type: 'mock'}).tree();
+ env.appendChild(iq);
+ return env;
+ };
+ return req;
+ }
- return {
- createRequest: createRequest,
- mockConnection: mockConnection,
- receive: receive,
- spyon: spyon
- };
-})();
+ return {
+ createRequest: createRequest,
+ mockConnection: mockConnection,
+ receive: receive,
+ spyon: spyon
+ };
+})();
@@ -1,3 +1,5 @@
+buster.spec.expose()
+
var mockConnection = helper.mockConnection,
spyon = helper.spyon, receive = helper.receive;
@@ -161,7 +163,7 @@ describe("Strophe Jabber-RPC plugin", function() {
var handler;
beforeEach(function() {
- handler = jasmine.createSpy();
+ handler = sinon.spy();
});
it("should be possible to add a request handler", function() {
@@ -246,7 +248,7 @@ describe("Strophe Jabber-RPC plugin", function() {
});
it("should NOT send forbidden access to the right nodes", function() {
- spyOn(connection, "send");
+ spyon(connection, "send");
var iq = $iq({type: "set", id: "123", from: "foo@jabber.org", to: connection.jid})
.c("query", {xmlns: Strophe.NS.RPC});
receive(connection, iq);
@@ -257,4 +259,4 @@ describe("Strophe Jabber-RPC plugin", function() {
});
-});
+});

0 comments on commit c8223b7

Please sign in to comment.