Remove an extra layer of wrapping for matchers/custom matchers

Helps reduce how nested custom matchers have to be for users as well as
Jasmine internal matchers

[#59161378]
This commit is contained in:
Sheel Choksi
2013-10-19 22:46:19 -07:00
parent 5f429fcb37
commit 39d7ebf28e
37 changed files with 437 additions and 494 deletions

View File

@@ -1,33 +1,33 @@
describe("toMatch", function() {
it("passes when RegExps are equivalent", function() {
var matcher = j$.matchers.toMatch(),
var matcherComparator = j$.matchers.toMatch(),
result;
result = matcher.compare(/foo/, /foo/);
result = matcherComparator(/foo/, /foo/);
expect(result.pass).toBe(true);
});
it("fails when RegExps are not equivalent", function() {
var matcher = j$.matchers.toMatch(),
var matcherComparator = j$.matchers.toMatch(),
result;
result = matcher.compare(/bar/, /foo/);
result = matcherComparator(/bar/, /foo/);
expect(result.pass).toBe(false);
});
it("passes when the actual matches the expected string as a pattern", function() {
var matcher = j$.matchers.toMatch(),
var matcherComparator = j$.matchers.toMatch(),
result;
result = matcher.compare('foosball', 'foo');
result = matcherComparator('foosball', 'foo');
expect(result.pass).toBe(true);
});
it("fails when the actual matches the expected string as a pattern", function() {
var matcher = j$.matchers.toMatch(),
var matcherComparator = j$.matchers.toMatch(),
result;
result = matcher.compare('bar', 'foo');
result = matcherComparator('bar', 'foo');
expect(result.pass).toBe(false);
});
});