From 3bf101bc1ef3b5a58fe2f1e2a2e7a681f6de6c09 Mon Sep 17 00:00:00 2001 From: Azul Date: Tue, 30 Oct 2012 15:09:13 +0100 Subject: we're expecting json responses - so put .json in the url --- src/jqueryRest.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/jqueryRest.js b/src/jqueryRest.js index f50080b..133e3fd 100644 --- a/src/jqueryRest.js +++ b/src/jqueryRest.js @@ -54,7 +54,7 @@ jqueryRest = function() { function sendVerifier(session, callback) { var salt = session.getSalt(); - $.post("users", { user: + $.post("users.json", { user: { login: session.getI(), password_salt: salt, password_verifier: session.getV(salt).toString(16)} @@ -62,13 +62,13 @@ jqueryRest = function() { } function handshake(session, callback) { - $.post("sessions", { login: session.getI(), + $.post("sessions.json", { login: session.getI(), A: session.getAstr()}, callback); } function authenticate(session, success) { $.ajax({ - url: "sessions/" + session.getI(), + url: "sessions/" + session.getI() + ".json", type: 'PUT', data: {client_auth: session.getM()}, success: success -- cgit v1.2.3 From e5ae94132bb55fdd10090dcd427e95e33e31f15e Mon Sep 17 00:00:00 2001 From: Azul Date: Mon, 12 Nov 2012 11:14:47 +0100 Subject: specifying charset and fetching jquery remotely This way you don't have to add jquery to the lib dir for specs to work --- spec/RestfulSpecRunner.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/RestfulSpecRunner.html b/spec/RestfulSpecRunner.html index a9d708b..f880720 100644 --- a/spec/RestfulSpecRunner.html +++ b/spec/RestfulSpecRunner.html @@ -2,6 +2,7 @@ "http://www.w3.org/TR/html4/loose.dtd"> + Jasmine Spec Runner @@ -12,7 +13,7 @@ - + -- cgit v1.2.3 From 71ba8a28ebf04b84a9d2f0eb1a64dedec2ec8fe3 Mon Sep 17 00:00:00 2001 From: Azul Date: Mon, 12 Nov 2012 11:14:58 +0100 Subject: adopting tests to new .json urls --- spec/restful/login.js | 6 +++--- spec/restful/signup.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/restful/login.js b/spec/restful/login.js index 9c43c00..4df62a8 100644 --- a/spec/restful/login.js +++ b/spec/restful/login.js @@ -52,9 +52,9 @@ describe("Login", function() { var success = sinon.spy(); this.srp.identify(success); - this.expectRequest('sessions', 'login=' +login+ '&A=' +A, 'POST'); + this.expectRequest('sessions.json', 'login=' +login+ '&A=' +A, 'POST'); this.respondJSON({salt: salt, B: B}); - this.expectRequest('sessions/'+login, 'client_auth='+M, 'PUT'); + this.expectRequest('sessions/'+login+'.json', 'client_auth='+M, 'PUT'); this.respondJSON({M2: M2}); expect(success).toHaveBeenCalled(); @@ -65,7 +65,7 @@ describe("Login", function() { var error = sinon.spy(); this.srp.identify(success, error); - this.expectRequest('sessions', 'login=' +login+ '&A=' +A, 'POST'); + this.expectRequest('sessions.json', 'login=' +login+ '&A=' +A, 'POST'); this.respondJSON({salt: salt, B: 0}); // aborting if B=0 expect(this.requests).toEqual([]); diff --git a/spec/restful/signup.js b/spec/restful/signup.js index 7b66dd7..e4d70df 100644 --- a/spec/restful/signup.js +++ b/spec/restful/signup.js @@ -22,7 +22,7 @@ describe("Signup", function() { this.srp.identify = callback; this.srp.session.getSalt = function() {return "4c78c3f8"}; this.srp.register(); - this.expectRequest('users', "user[login]=testuser&user[password_salt]=4c78c3f8&user[password_verifier]=474c26aa42d11f20544a00f7bf9711c4b5cf7aab95ed448df82b95521b96668e7480b16efce81c861870302560ddf6604c67df54f1d04b99d5bb9d0f02c6051ada5dc9d594f0d4314e12f876cfca3dcd99fc9c98c2e6a5e04298b11061fb8549a22cde0564e91514080df79bca1c38c682214d65d590f66b3719f954b078b83c", 'POST') + this.expectRequest('users.json', "user[login]=testuser&user[password_salt]=4c78c3f8&user[password_verifier]=474c26aa42d11f20544a00f7bf9711c4b5cf7aab95ed448df82b95521b96668e7480b16efce81c861870302560ddf6604c67df54f1d04b99d5bb9d0f02c6051ada5dc9d594f0d4314e12f876cfca3dcd99fc9c98c2e6a5e04298b11061fb8549a22cde0564e91514080df79bca1c38c682214d65d590f66b3719f954b078b83c", 'POST') this.respondJSON({password_salt: "4c78c3f8", login: "testuser", ok: "true"}); expect(callback).toHaveBeenCalled(); }); -- cgit v1.2.3