Skip to content

Commit

Permalink
looky there - jasmine already had an argsToArray. #GMTA
Browse files Browse the repository at this point in the history
  • Loading branch information
searls committed Oct 5, 2011
1 parent fd2a40d commit 5d82546
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/jasmine-stealth.js
@@ -1,25 +1,21 @@
//https://github.com/searls/jasmine-stealth
(function(jasmine) {
var argsToArray = function(args) {
return Array.prototype.slice.call(args, 0);
};

beforeEach(function() {
this.stubFor = this.spyOn;
});

jasmine.createStub = jasmine.createSpy;
jasmine.Spy.prototype.when = function() {
var spy = this,
ifThis = argsToArray(arguments);
ifThis = jasmine.util.argsToArray(arguments);
spy._stealth_stubbings = spy._stealth_stubbings || [];

var priorStubbing = spy.plan();

spy.andCallFake(function() {
for(var i=0;i<spy._stealth_stubbings.length;i++) {
var stubbing = spy._stealth_stubbings[i];
if(jasmine.getEnv().equals_(stubbing.ifThis,argsToArray(arguments))) {
if(jasmine.getEnv().equals_(stubbing.ifThis,jasmine.util.argsToArray(arguments))) {
return stubbing.thenThat;
}
}
Expand Down

0 comments on commit 5d82546

Please sign in to comment.