Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helper example won't run as is #193

Open
jlaurens opened this issue Oct 7, 2020 · 0 comments
Open

Helper example won't run as is #193

jlaurens opened this issue Oct 7, 2020 · 0 comments

Comments

@jlaurens
Copy link

jlaurens commented Oct 7, 2020

The helpers page reads

Assertion.overwriteMethod('above', function (_super) {
  return function assertAge (n) {
    if (utils.flag(this, 'model.age')) {
       [...]

      // next, make sure we have an age
      new Assertion(obj).to.have.deep.property('_attrs.age').a('number'); //<<<< ERROR

      // now we compare
      [...]
  };
});

The assertion always fails because '_attrs.age' is not a valid property name.

If you do not want to remove it, simply replace it by

      new Assertion(obj._attrs).to.have.property('age').a('number');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant