Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Stubbing global objects' methods

Choose a tag to compare

@jubianchi jubianchi released this 26 Jul 22:18
· 34 commits to master since this release
  • Add stubs to mock global objects methods
var $ = require('jquery'),
    stubbed = this.generateStub($, "ajax"),
    object = {
        method: function() {
            $.ajax("http://foo.bar");
        }
    };

this
    .if(object.method())
    .then()
        .stub(stubbed).wasCalled().withArguments("http://foo.bar")
;

$.load.restore();
  • Stubbed methods are restored after each test
  • Add Grunt Task
  • Fix exit status code