var request = require('supertest');
var expect  = require('chai').expect;
var fs      = require('fs');

var app = require('../examples/afterSend');

function cleanupLog(done){
  fs.exists('body.log', function (exists) {
    if(exists){
      fs.unlink('body.log',done);
    } else {
      done();
    }
  });
}

describe('Using the after() method', function() {

  before(cleanupLog);

  it('should intercept the generated .html and respond with the same .html', function(done) {
    request(app)
      .get('/README.md')
      .expect(200)
      .end(done);
  });

  it('verify log file exist', function(done) {
    fs.exists('body.log', function(exist) {
      expect(exist).to.equal(true);
      done();
    });
  });

  after(cleanupLog);
});

@@ -1,36 +1,73 @@
 var 
-request = require('supertest
+fs      = require('fs');%0Avar app = require('../examples/afterSend
 ');%0A
@@ -77,17 +77,16 @@
  expect 
- 
 = requir
@@ -92,94 +92,284 @@
 re('
-chai').expect;%0Avar fs      = require('fs');%0A%0Avar app = require('../examples/afterSend'
+unexpected')%0A    .clone()%0A    .installPlugin(require('unexpected-express'))%0A    .addAssertion('to yield response', function (expect, subject, value) %7B%0A        return expect(app, 'to yield exchange', %7B%0A            request: subject,%0A            response: value%0A        %7D);%0A    %7D
 );%0A%0A
@@ -683,36 +683,32 @@
 html', function(
-done
 ) %7B%0A    request(
@@ -705,78 +705,58 @@
   re
-quest(app)%0A      .get('/README.md')%0A      .expect(200)%0A      .end(done
+turn expect('/README.md', 'to yield response', 200
 );%0A 
@@ -804,20 +804,16 @@
 ion(
-done
 ) %7B%0A    
 fs.e
@@ -808,16 +808,30 @@
 ) %7B%0A    
+return expect(
 fs.exist
@@ -823,32 +823,36 @@
 expect(fs.exists
+Sync
 ('body.log', fun
@@ -850,83 +850,23 @@
 log'
+)
 , 
-function(exist) %7B%0A      expect(exist).to.equal(true);%0A      done();%0A    %7D
+'to be true'
 );%0A 

rewrite tests/afterSend.test.js