ThomasBurleson/jasmine-as-promised — pull request #4 by janeklb (2014-03-07 16:36:46+00:00)
Title: invoking expectedFn with apply to prevent wrapping of result

The readme presents the use of the "expectFn" style of using `runs(...)`:

```js
it( "should respond successfully for valid authors", function ()
{
runs(
function()
{
return authenticator.validate("Domenic Denicola" );
},
function checkExpectations( result )
{
expect( result.valid ).toBeEqual( 1 );
expect( result.level ).toBeEqual( "awesome" );
}
);
});
```

However, result passed to `expectFn` comes wrapped in an array because the library is using `expectFn.call` vs. `expectFn.apply`. As a fix the readme _could_ read:

```js
it( "should respond successfully for valid authors", function ()
{
runs(
function()
{
return authenticator.validate("Domenic Denicola" );
},
function checkExpectations( result )
{
result = result[0];
expect( result.valid ).toBeEqual( 1 );
expect( result.level ).toBeEqual( "awesome" );
}
);
});
```
But it seems to make sense to use `expectFn.apply` instead.