Probably BUG with preValidate() and null value #80

Closed
starkovv opened this Issue Nov 19, 2012 · 1 comment

Projects

None yet

2 participants

@starkovv

Have a model:

module.exports = class Session extends Model

  urlRoot: '/sessions'
  idAttribute: 'user_id'

  defaults:
    authenticated: null

  validation:
    authenticated:
      required: false

Have a test:

...
  it 'is valid when not presented', ->
    @session.set('authenticated', null)
    expect(@session.preValidate('authenticated', null)).to.equal('')
...

When I run test it raises error:

expected false to equal ''

For some reason if I do preValidate() with null attribute value it returns false instead of undefined as described in docs.

Check this out please.

@thedersen
Owner

Hi,

Will look into this.

@thedersen thedersen added a commit that closed this issue Nov 24, 2012
@thedersen Made sure preValidate handles null value. Updated readme with correct…
… return values for preValidate. Closes #80
becdd9c
@thedersen thedersen closed this in becdd9c Nov 24, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment