Fixes for 'Merge pull request #100 from gvanhove/objectContaining' #163

wants to merge 3 commits into


None yet
2 participants

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(/<jasmine.any(function Object.*)>/);

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(/<jasmine.any([\s]function Object[\S\s])>/);

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).

gvictorv added some commits Nov 25, 2011

@gvictorv gvictorv Fixed object containing related inconsistencies between the implement…
…ation in 'src/*' and 'lib/jasmine-core/jasmine.js'.

Additionally removed unnecessary object containing related code in 'src/core/Env.js'.
@gvictorv gvictorv Adjusted object containing related test cases in 'MatchersSpec.js' to…
… be more browser compatible.
@gvictorv gvictorv Fixed '@example' in documentation of method 'jasmine.objectContaining'. 5fa15fb

infews commented May 27, 2013

Closing. I believe this code has been fixed on the matchers_redo branch.

Thanks for the find.

infews closed this May 27, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment