Merge branch 'rullopat-greater-than-or-equal-less-than-or-equal-matchers'
- Merges #1049 - Fixes #1013
This commit is contained in:
@@ -89,6 +89,8 @@ getJasmineRequireObj().requireMatchers = function(jRequire, j$) {
|
||||
'toBeDefined',
|
||||
'toBeFalsy',
|
||||
'toBeGreaterThan',
|
||||
'toBeGreaterThanOrEqual',
|
||||
'toBeLessThanOrEqual',
|
||||
'toBeLessThan',
|
||||
'toBeNaN',
|
||||
'toBeNull',
|
||||
@@ -2977,6 +2979,21 @@ getJasmineRequireObj().toBeGreaterThan = function() {
|
||||
};
|
||||
|
||||
|
||||
getJasmineRequireObj().toBeGreaterThanOrEqual = function() {
|
||||
|
||||
function toBeGreaterThanOrEqual() {
|
||||
return {
|
||||
compare: function(actual, expected) {
|
||||
return {
|
||||
pass: actual >= expected
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return toBeGreaterThanOrEqual;
|
||||
};
|
||||
|
||||
getJasmineRequireObj().toBeLessThan = function() {
|
||||
function toBeLessThan() {
|
||||
return {
|
||||
@@ -2991,6 +3008,21 @@ getJasmineRequireObj().toBeLessThan = function() {
|
||||
|
||||
return toBeLessThan;
|
||||
};
|
||||
getJasmineRequireObj().toBeLessThanOrEqual = function() {
|
||||
function toBeLessThanOrEqual() {
|
||||
return {
|
||||
|
||||
compare: function(actual, expected) {
|
||||
return {
|
||||
pass: actual <= expected
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return toBeLessThanOrEqual;
|
||||
};
|
||||
|
||||
getJasmineRequireObj().toBeNaN = function(j$) {
|
||||
|
||||
function toBeNaN() {
|
||||
|
||||
29
spec/core/matchers/toBeGreaterThanOrEqualSpec.js
Normal file
29
spec/core/matchers/toBeGreaterThanOrEqualSpec.js
Normal file
@@ -0,0 +1,29 @@
|
||||
describe("toBeGreaterThanOrEqual", function() {
|
||||
it("passes when actual >= expected", function() {
|
||||
var matcher = jasmineUnderTest.matchers.toBeGreaterThanOrEqual(),
|
||||
result;
|
||||
|
||||
result = matcher.compare(2, 1);
|
||||
expect(result.pass).toBe(true);
|
||||
|
||||
result = matcher.compare(1, 1);
|
||||
expect(result.pass).toBe(true);
|
||||
|
||||
result = matcher.compare(1.0000001, 1);
|
||||
expect(result.pass).toBe(true);
|
||||
|
||||
result = matcher.compare(1.0, 1.0);
|
||||
expect(result.pass).toBe(true);
|
||||
})
|
||||
|
||||
it("fails when actual < expected", function() {
|
||||
var matcher = jasmineUnderTest.matchers.toBeGreaterThanOrEqual(),
|
||||
result;
|
||||
|
||||
result = matcher.compare(1, 2);
|
||||
expect(result.pass).toBe(false);
|
||||
|
||||
result = matcher.compare(1, 1.0000001);
|
||||
expect(result.pass).toBe(false);
|
||||
})
|
||||
});
|
||||
29
spec/core/matchers/toBeLessThanOrEqualSpec.js
Normal file
29
spec/core/matchers/toBeLessThanOrEqualSpec.js
Normal file
@@ -0,0 +1,29 @@
|
||||
describe("toBeLessThanOrEqual", function() {
|
||||
it("passes when actual <= expected", function() {
|
||||
var matcher = jasmineUnderTest.matchers.toBeLessThanOrEqual(),
|
||||
result;
|
||||
|
||||
result = matcher.compare(1, 2);
|
||||
expect(result.pass).toBe(true);
|
||||
|
||||
result = matcher.compare(1, 1);
|
||||
expect(result.pass).toBe(true);
|
||||
|
||||
result = matcher.compare(1, 1.0000001);
|
||||
expect(result.pass).toBe(true);
|
||||
|
||||
result = matcher.compare(1.0, 1.0);
|
||||
expect(result.pass).toBe(true);
|
||||
});
|
||||
|
||||
it("fails when actual < expected", function() {
|
||||
var matcher = jasmineUnderTest.matchers.toBeLessThanOrEqual(),
|
||||
result;
|
||||
|
||||
result = matcher.compare(2, 1);
|
||||
expect(result.pass).toBe(false);
|
||||
|
||||
result = matcher.compare(1.0000001, 1);
|
||||
expect(result.pass).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -5,6 +5,8 @@ getJasmineRequireObj().requireMatchers = function(jRequire, j$) {
|
||||
'toBeDefined',
|
||||
'toBeFalsy',
|
||||
'toBeGreaterThan',
|
||||
'toBeGreaterThanOrEqual',
|
||||
'toBeLessThanOrEqual',
|
||||
'toBeLessThan',
|
||||
'toBeNaN',
|
||||
'toBeNull',
|
||||
|
||||
14
src/core/matchers/toBeGreaterThanOrEqual.js
Normal file
14
src/core/matchers/toBeGreaterThanOrEqual.js
Normal file
@@ -0,0 +1,14 @@
|
||||
getJasmineRequireObj().toBeGreaterThanOrEqual = function() {
|
||||
|
||||
function toBeGreaterThanOrEqual() {
|
||||
return {
|
||||
compare: function(actual, expected) {
|
||||
return {
|
||||
pass: actual >= expected
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return toBeGreaterThanOrEqual;
|
||||
};
|
||||
14
src/core/matchers/toBeLessThanOrEqual.js
Normal file
14
src/core/matchers/toBeLessThanOrEqual.js
Normal file
@@ -0,0 +1,14 @@
|
||||
getJasmineRequireObj().toBeLessThanOrEqual = function() {
|
||||
function toBeLessThanOrEqual() {
|
||||
return {
|
||||
|
||||
compare: function(actual, expected) {
|
||||
return {
|
||||
pass: actual <= expected
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return toBeLessThanOrEqual;
|
||||
};
|
||||
Reference in New Issue
Block a user