Use Object.create to make an object with null prototype
This commit is contained in:
@@ -1,9 +1,4 @@
|
|||||||
describe('toBeInstanceOf', function() {
|
describe('toBeInstanceOf', function() {
|
||||||
function setPrototypeOf(object, proto) {
|
|
||||||
// Support older environments
|
|
||||||
Object.setPrototypeOf ? Object.setPrototypeOf(object, proto) : object.__proto__ = proto;
|
|
||||||
}
|
|
||||||
|
|
||||||
describe('when expecting Number', function() {
|
describe('when expecting Number', function() {
|
||||||
it('passes for literal number', function() {
|
it('passes for literal number', function() {
|
||||||
var matcher = jasmineUnderTest.matchers.toBeInstanceOf();
|
var matcher = jasmineUnderTest.matchers.toBeInstanceOf();
|
||||||
@@ -159,8 +154,7 @@ describe('toBeInstanceOf', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('passes for objects with no constructor', function() {
|
it('passes for objects with no constructor', function() {
|
||||||
var object = {};
|
var object = Object.create(null);
|
||||||
setPrototypeOf(object, null);
|
|
||||||
|
|
||||||
var matcher = jasmineUnderTest.matchers.toBeInstanceOf();
|
var matcher = jasmineUnderTest.matchers.toBeInstanceOf();
|
||||||
var result = matcher.compare(object, Object);
|
var result = matcher.compare(object, Object);
|
||||||
|
|||||||
Reference in New Issue
Block a user