Skip to content

Commit

Permalink
Move all helpers into assert.
Browse files Browse the repository at this point in the history
  • Loading branch information
aflatter committed Mar 28, 2012
1 parent 4136657 commit 2fe75f9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/session_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ var assert = require('chai').assert
, Session = wd.Session
, ClientMock = wd.ClientMock;

var assertOneRequest = function(client, opts) {
assert.oneRequest = function(client, opts) {
assert.equal(client.callCount, 1, 'Only one request was made.');
assertRequest(client.lastRequest, opts);
assert.request(client.lastRequest, opts);
};

var assertRequest = function(request, opts) {
assert.request = function(request, opts) {
if (opts.method) {
assert.equal(request.method, opts.method);
}
Expand Down Expand Up @@ -101,7 +101,7 @@ suite('Session', function() {
session = Session.create({id: 1, client: client});
session.url(callback);

assertOneRequest(client, {
assert.oneRequest(client, {
method: 'GET'
, resource: '/session/' + id + '/url'
, params: null
Expand All @@ -115,7 +115,7 @@ suite('Session', function() {
session = Session.create({id: 1, client: client});
session.url(url, callback);

assertOneRequest(client, {
assert.oneRequest(client, {
method: 'POST'
, resource: '/session/' + id + '/url'
, params: {url: url}
Expand Down Expand Up @@ -143,7 +143,7 @@ suite('Session', function() {
session = Session.create({id: 1, client: client});
session.element(strategy, value, callback);

assertOneRequest(client, {
assert.oneRequest(client, {
method: 'POST'
, resource: '/session/' + id + '/element'
, params: {using: strategy, value: value}
Expand All @@ -169,7 +169,7 @@ suite('Session', function() {
session = Session.create({id: 1, client: client});
session.element(strategy, value, callback);

assertOneRequest(client, {
assert.oneRequest(client, {
method: 'POST'
, resource: '/session/' + id + '/element'
, params: {using: strategy, value: value}
Expand Down

0 comments on commit 2fe75f9

Please sign in to comment.