Sha256: ad96c88cb61aeb58dfdb25b19e010e11c4efbd62be0ba0c9699e026211be55df

Contents?: true

Size: 928 Bytes

Versions: 16

Compression:

Stored size: 928 Bytes

Contents

/*!
 * Should
 * Copyright(c) 2010-2014 TJ Holowaychuk <tj@vision-media.ca>
 * MIT Licensed
 */

//var statusCodes = require('http').STATUS_CODES;

module.exports = function(should, Assertion) {

  Assertion.add('header', function(field, val) {
    this
      .have.property('headers')
      .and.have.property(field.toLowerCase(), val);
  });

  Assertion.add('status', function(code) {
    //this.params = { operator: 'to have response code ' + code + ' ' + i(statusCodes[code])
    //    + ', but got ' + this.obj.statusCode + ' ' + i(statusCodes[this.obj.statusCode]) }

    this.have.property('statusCode', code);
  });

  Assertion.add('json', function() {
    this.have.property('headers')
      .and.have.property('content-type').include('application/json');
  }, true);

  Assertion.add('html', function() {
    this.have.property('headers')
      .and.have.property('content-type').include('text/html');
  }, true);
};

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
stylus-source-0.42.2 vendor/node_modules/should/lib/ext/http.js
stylus-source-0.42.1 vendor/node_modules/should/lib/ext/http.js
stylus-source-0.42.0 vendor/node_modules/should/lib/ext/http.js
stylus-source-0.41.3 vendor/node_modules/should/lib/ext/http.js
stylus-source-0.41.2 vendor/node_modules/should/lib/ext/http.js
stylus-source-0.41.1 vendor/node_modules/should/lib/ext/http.js
stylus-source-0.41.0 vendor/node_modules/should/lib/ext/http.js
stylus-source-0.40.3 vendor/node_modules/should/lib/ext/http.js
stylus-source-0.40.2 vendor/node_modules/should/lib/ext/http.js
stylus-source-0.40.1 vendor/node_modules/should/lib/ext/http.js
stylus-source-0.40.0 vendor/node_modules/should/lib/ext/http.js
stylus-source-0.39.4 vendor/node_modules/should/lib/ext/http.js
stylus-source-0.39.3 vendor/node_modules/should/lib/ext/http.js
stylus-source-0.39.2 vendor/node_modules/should/lib/ext/http.js
stylus-source-0.39.1 vendor/node_modules/should/lib/ext/http.js
stylus-source-0.39.0 vendor/node_modules/should/lib/ext/http.js