Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Commit 4aad843

Browse files
author
Miroslav Bajtoš
committed
Merge pull request #28 from clarkorz/fix/url-doesnot-reproduce
Fix handling of dynamic URLs in the test builder Close #28 Fix #27
2 parents 26e573f + a85e7e6 commit 4aad843

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

lib/helpers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ _describe.whenCalledRemotely = function(verb, url, data, cb) {
156156
describe(verb.toUpperCase() + ' ' + urlStr, function() {
157157
beforeEach(function(cb) {
158158
if(typeof url === 'function') {
159-
url = url.call(this);
159+
this.url = url.call(this);
160160
}
161161
this.remotely = true;
162162
this.verb = verb.toUpperCase();

test/test.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,18 @@ describe('helpers', function () {
7272
});
7373
});
7474
});
75+
helpers.describe.staticMethod('findById', function() {
76+
helpers.beforeEach.givenModel('xxx-test-model', {foo: 'bar'});
77+
helpers.describe.whenCalledRemotely('GET', function () {
78+
return '/xxx-test-models/' + this['xxx-test-model'].id;
79+
}, function() {
80+
it('should retrieve the expected model in the first test', function () {
81+
assert.equal(this.res.body.id, this['xxx-test-model'].id);
82+
});
83+
it('should retrieve the expected model in subsequent tests', function () {
84+
assert.equal(this.res.body.id, this['xxx-test-model'].id);
85+
});
86+
});
87+
});
7588
});
7689
});

0 commit comments

Comments
 (0)