pivotal/jasmine — pull request #163 by gvictorv (2011-11-25 23:17:05+00:00)
Title: Fixes for 'Merge pull request #100 from gvanhove/objectContaining'

The first commit fixes object containing related inconsistencies between the implementation in 'src/*' and 'lib/jasmine-core/jasmine.js' causing all newly introduced object containing related test cases to fail (at least when running 'spec/runner.html'). I assumed that the implementation of the object containing related test cases specify the truth when using the method 'jasmineMatches' instead of just 'matches' and 'jasmineToString' instead of just 'toString'. Also 'ObjectContaining.jasmineToString' was not returning 'jasmine.objectContaining' but 'jasmine.hashContaining' in the resulting string.

I've fixed this in 'lib/jasmine-core/jasmine.js'.

Additionally, again assuming that the usage of the method 'jasmineMatches' is desired, I've additionally removed some unnecessary code in 'src/core/Env.js'.

The second commit regards to the newly introduced object containing related test cases in 'MatchersSpec.js'.

Using '.*' in the following test:

expect(any.jasmineToString()).toMatch(//);

does not match succesfully in several browser including FireFox (for me: 3.6) as well as IE (for me: 8). The result contains newlines and will not match. The "m" flag does not work either. Additionally IE is adding whitespaces in the resulting string, like: 'jasmine.any( function ...' instead of 'jasmine.any(function ...' which also results in failing test cases.

I've adjusted all similar tests to use the following regexp:

expect(any.jasmineToString()).toMatch(//);

which matches the desired expectation in all browsers which I had available for testing (IE8, FireFox 3.5, Safari 5.0.5, Opera 10, Chrome 15). With this pattern variant the tests are green in all browsers (though IE still has problems with 4 tests in 'ConsoleReporter' failing with a TypeError because of an unsupported property or method - but this is another issue not related to this pull request).