'use strict';

var assert = require('assert-plus');
var flash  = require('../lib/flash');

describe('Request tests ::', function () {

  var request  = {session: {}};
  var response = {locals: {}};

  before(function (done) {
    return flash(request, response, done);
  });

  describe("addFlash(type, message)", function () {
    it('is callable ', function () {
      assert.func(request.addFlash);
      assert.ok(request.addFlash(
        'success',
        'Is callable and and stores a message.'
      ))
    });

    it('stores a message', function () {
      var session = request.session[Object.keys(request.session)[0]];
      assert.object(session, 'Is an object');
      assert.array(session.success);
      assert.strictEqual(
        session.success[0],
        'Is callable and and stores a message.'
      );
    });

    it('stores more than one message per type', function () {
      var session = request.session[Object.keys(request.session)[0]];
      assert.object(session, 'Is an object');
      assert.array(session.success);
      assert.strictEqual(
        session.success[0],
        'Is callable and and stores a message.'
      );
    });
  });

});

@@ -280,17 +280,17 @@
 escribe(
-%22
+'
 addFlash
@@ -308,9 +308,9 @@
 age)
-%22
+'
 , fu
@@ -376,16 +376,25 @@
 rt.func(
+%0A        
 request.
@@ -401,16 +401,62 @@
 addFlash
+,%0A        'addFlash must be a function'%0A      
 );%0A     
@@ -483,25 +483,16 @@
 ddFlash(
-%0A        
 'success
@@ -497,46 +497,91 @@
 ss',
-%0A        'Is callable and and s
+ 'Stores a message.'));%0A      assert.ok(request.addFlash('success', 'S
 tores a
+nother
  mes
@@ -590,17 +590,11 @@
 ge.'
-%0A      
 ))
+;
 %0A   
@@ -726,36 +726,70 @@
 sert.object(
-session, 'Is
+%0A        session,%0A        'The session must be
  an object')
@@ -779,32 +779,39 @@
 st be an object'
+%0A      
 );%0A      assert.
@@ -808,32 +808,41 @@
    assert.array(
+%0A        
 session.success)
@@ -832,32 +832,104 @@
  session.success
+,%0A        'The flash message type must have an array of messages'%0A      
 );%0A      assert.
@@ -978,37 +978,17 @@
        '
-Is callable and and s
+S
 tores a 
@@ -1164,178 +1164,498 @@
 ert.
-object(session, 'Is an object');%0A      assert.array(session.success);%0A      assert.strictEqual(%0A        session.success%5B0%5D,%0A        'Is callable and and stores a message.
+strictEqual(%0A        session.success.length,%0A        2,%0A        'The flash message type must have an array of messages'%0A      );%0A    %7D);%0A  %7D);%0A%0A  describe('getFlash(type)', function () %7B%0A    it('is callable', function () %7B%0A      assert.func(%0A        request.getFlash,%0A        'getFlash must be a function'%0A      );%0A    %7D);%0A  %7D);%0A%0A  describe('hasFlash(type)', function () %7B%0A    it('is callable', function () %7B%0A      assert.func(%0A        request.hasFlash,%0A        'hasFlash must be a function
 '%0A  

Update the request unit tests