Skip to content

Commit

Permalink
Remove a level of indirection
Browse files Browse the repository at this point in the history
  • Loading branch information
xaviershay committed Dec 29, 2008
1 parent 44c44c6 commit b7fd409
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions spec/spec_helper.js
Expand Up @@ -3,18 +3,6 @@ Screw.Unit(function() {
$('dom_test').empty();
});

Screw.Unit.it_behaves_like_a_method_with_callback_protection = function(action) {
it("throws an exception", function() {
var message = '';
try {
action();
} catch(e) {
message = e
}
expect(message).to(equal, 'callback needs to be a function, it was: null');
});
}

Screw.Unit.enumerableContext = function(callStatic, callIterator, context) {
var toArray = function() {
var result = []
Expand All @@ -34,8 +22,14 @@ Screw.Unit(function() {

describe("given a callback that is not callable", function () {
describeStaticAndIterator(function (f) {
Screw.Unit.it_behaves_like_a_method_with_callback_protection(function() {
f.apply(this, [[]].concat(extraArguments.concat([null])));
it("throws an exception", function() {
var message = '';
try {
f.apply(this, [[]].concat(extraArguments.concat([null])));
} catch(e) {
message = e
}
expect(message).to(equal, 'callback needs to be a function, it was: null');
});
});
});
Expand Down

0 comments on commit b7fd409

Please sign in to comment.