diff --git a/jasmine.iws b/jasmine.iws index dc05fff..fa50e8a 100644 --- a/jasmine.iws +++ b/jasmine.iws @@ -83,16 +83,7 @@ - - - - - - - - - - + @@ -101,7 +92,7 @@ - + @@ -110,7 +101,7 @@ - + @@ -131,7 +122,7 @@ - + @@ -140,7 +131,7 @@ - + @@ -305,6 +296,33 @@ + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + @@ -429,7 +420,7 @@ - + @@ -514,57 +505,57 @@ - + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + - + diff --git a/lib/jasmine.js b/lib/jasmine.js index ff9f763..fce4aea 100755 --- a/lib/jasmine.js +++ b/lib/jasmine.js @@ -200,6 +200,11 @@ Jasmine.Matchers.method('should_not_equal', function (expected) { 'Expected ' + expected + ' to not equal ' + this.actual + ', but it does.'); }); +Jasmine.Matchers.method('should_match', function (reg_exp) { + return this.report((reg_exp.match(this.actual)), + 'Expected ' + this.actual + ' to match ' + reg_exp + '.'); +}); + /* * Jasmine spec constructor */ diff --git a/test/bootstrap.js b/test/bootstrap.js index dd963a7..0a9d045 100755 --- a/test/bootstrap.js +++ b/test/bootstrap.js @@ -57,6 +57,14 @@ var testMatchersComparisons = function () { expected = new Jasmine.Matchers(true); reporter.test(!(expected.should_not_equal(true)), 'expects_that(true).should_not_equal(false) retruned true'); + + expected = new Jasmine.Matchers('foobarbel'); + reporter.test((expected.should_match(/bar/)), + 'expects_that(forbarbel).should_match(/bar/) returned false'); + + expected = new Jasmine.Matchers('foobazbel'); + reporter.test(!(expected.should_match(/bar/)), + 'expects_that(forbazbel).should_match(/bar/) returned true'); } var testMatchersReporting = function () { @@ -818,13 +826,13 @@ var testHandlesExceptions = function () { reporter.test((runner.suites[0].specs[0].expectationResults[0].passed === false), 'First test should have failed, got passed'); - reporter.test((runner.suites[0].specs[0].expectationResults[0].message === 'ReferenceError: fakeObject is not defined in file:///Users/pivotal/workspace/jasmine/test/bootstrap.js (line 791)'), + reporter.test((runner.suites[0].specs[0].expectationResults[0].message === 'ReferenceError: fakeObject is not defined in file:///Users/pivotal/workspace/jasmine/test/bootstrap.js (line 799)'), 'First test should have shown some exception string, got ' + runner.suites[0].specs[0].expectationResults[0].message); reporter.test((runner.suites[0].specs[1].expectationResults[0].passed === false), 'Second test should have a failing first result, got passed'); - reporter.test((runner.suites[0].specs[1].expectationResults[0].message === 'ReferenceError: fakeObject2 is not defined in file:///Users/pivotal/workspace/jasmine/test/bootstrap.js (line 797)'), + reporter.test((runner.suites[0].specs[1].expectationResults[0].message === 'ReferenceError: fakeObject2 is not defined in file:///Users/pivotal/workspace/jasmine/test/bootstrap.js (line 805)'), 'Second test should have shown an exception message for the first result, got ' + runner.suites[0].specs[1].expectationResults[0].message); reporter.test((runner.suites[0].specs[1].expectationResults[1].passed === true),