Files
jasmine/spec/javascripts/core/matchers/toBeNaNSpec.js
Gregg Van Hove and Rajan Agaskar 5017d1a4f1 Make rake jasmine:ci run specs correctly.
- Will replace rake core_specs.
- Remove obsolete dependencies & files -- most of these were for build tasks we
  are no longer using. Notably, rspec and spec_helper were deleted.
2013-09-25 10:11:02 -07:00

37 lines
990 B
JavaScript

describe("toBeNaN", function() {
it("passes for NaN with a custom .not fail", function() {
var matcher = j$.matchers.toBeNaN(),
result;
result = matcher.compare(Number.NaN);
expect(result.pass).toBe(true);
expect(result.message).toEqual("Expected actual not to be NaN.");
});
it("fails for anything not a NaN", function() {
var matcher = j$.matchers.toBeNaN();
result = matcher.compare(1);
expect(result.pass).toBe(false);
result = matcher.compare(null);
expect(result.pass).toBe(false);
result = matcher.compare(void 0);
expect(result.pass).toBe(false);
result = matcher.compare('');
expect(result.pass).toBe(false);
result = matcher.compare(Number.POSITIVE_INFINITY);
expect(result.pass).toBe(false);
});
it("has a custom message on failure", function() {
var matcher = j$.matchers.toBeNaN(),
result = matcher.compare(0);
expect(result.message).toEqual("Expected 0 to be NaN.");
});
});