title: Sails js :: Testing variables passed to views
body: <h3>controller</h3>
  <pre><code>module.exports = {
  
    index: function (req, res) {
      res.view({message: 'hello'});
    }
  }
  </code></pre>
  <p>How to test if the variable <code>message</code> is been set correctly?</p>
  <pre><code>var request = require('supertest');
  
  describe('HomeController', function() {
    describe('index', function() {
      it('should return success', function (done) {
        request(sails.hooks.http.app)
          .get('/')
          .expect(200).end(function (err, res) {
            if (err) throw err;
            res.body.should.have.property('message');
            done();
          });
      });
    });
  });
  </code></pre>
  <p><code>res.body</code> returns {}</p>