Clear handler cache - #193
Conversation
…gistering a model.
|
Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test." |
|
ok to test |
|
Refer to this link for build results: http://ci.strongloop.com/job/loopback/950/ |
|
Approach and code look good to me. |
|
Thanks @ritch! |
There was a problem hiding this comment.
Could you rewrite this test to describe the behaviour as observed by a LB user - i.e. Color is available via REST - instead of describing the implementation details?
Something along these lines:
app.use(loopback.rest());
request(app).get('/colors').expect(404, function(err, res) {
if (err) return done(err);
var Color = db.createModel('color', {name: String});
app.model(Color);
request(app).get('/colors').expect(200, done);
});There was a problem hiding this comment.
Hmm, I have not realised the patch had already landed. Never mind, this is not critical, the test can stay as it is.
There was a problem hiding this comment.
I could rewrite the test, no problem. Then maybe you guys could merge it
again.
What do you think?
On Wednesday, February 19, 2014, Miroslav Bajtoš notifications@github.com
wrote:
In test/app.test.js:
@@ -29,6 +29,14 @@ describe('app', function() {
expect(app.remotes().exports).to.eql({ color: Color });
});
- it('clears handler cache', function() {
var originalRestHandler = app.handler('rest');var Color = db.createModel('color', {name: String});app.model(Color);var newRestHandler = app.handler('rest');expect(originalRestHandler).to.not.equal(newRestHandler);- });
Hmm, I have not realised the patch had already landed. Never mind, this is
not critical, the test can stay as it is.—
Reply to this email directly or view it on GitHubhttps://github.com//pull/193/files#r9861989
.
Guilherme Machado Cirne
gcirne@gmail.com
There was a problem hiding this comment.
(For some background to this PR, please see #187)
This is the simplest possible way I can think of clearing the handler cache after registering a new model. I've opened this PR as a starting point so that you guys can help point me in the right direction.
@bajtos, @rmg, @ritch what do you think?