Skip to content
Myr

tests: check render error without engine-specific message

Before adoption: this commit came in with the history the project adopted, so no landing records it.

closes #3251

authored by Kunal Pathak · committed by Douglas Christopher Wilson · parent d7da225 · Browse files · 3 files+11 added−10 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+11 added−10 removed

  • tests:+11 added−10 removed

3 files+11 added−10 removed

modified:test/support/tmpl.js+1 added
modified:test/app.render.js+4 added-6 removed
95 unmodified lines
96 var app = createApp();9798 app.set('views', path.join(__dirname, 'fixtures'))99100 app.render('user.tmpl', function (err, str) {101 // nextTick to prevent cyclic102 process.nextTick(function(){103 err.message.should.match(/Cannot read property '[^']+' of undefined/);104 done();105 });100 app.render('user.tmpl', function (err) {101 assert.ok(err)102 assert.equal(err.name, 'RenderError')103 done()104 })105 })106 })107
266 unmodified lines
modified:test/res.render.js+6 added-4 removed
103 unmodified lines
104 res.render('user.tmpl');105 });106107 app.use(function(err, req, res, next){108 res.end(err.message);108 res.status(500).send('got error: ' + err.name)109 });110111 request(app)112 .get('/')113 .expect(/Cannot read property '[^']+' of undefined/, done);113 .expect(500, 'got error: RenderError', done)114 })115 })116117 describe('when "view engine" is given', function(){
210 unmodified lines
328 app.set('views', path.join(__dirname, 'fixtures'))329330 app.use(function(req, res){331 res.render('user.tmpl', function (err) {332 res.end(err.message);332 if (err) {333 res.status(500).send('got error: ' + err.name)334 }335 });336 });337338 request(app)339 .get('/')338 .expect(/Cannot read property '[^']+' of undefined/, done);340 .expect(500, 'got error: RenderError', done)341 })342 })343 })344})
8 unmodified lines