Sha256: 850cff5020cbb7951386571a166338da09beee70f57082e081ceb541638fed8e

Contents?: true

Size: 746 Bytes

Versions: 4

Compression:

Stored size: 746 Bytes

Contents

describe 'App.Validators.Exclusion', ->
  beforeEach ->
    @dummy = new App.Models.Dummy author: 'admin'

  afterEach -> App.Env.loco.setLocale 'en'

  it 'adds error if value is in an array', ->
    @dummy.isValid()
    expect(@dummy.errors.author[0]).toEqual "is reserved"

  it 'is valid if value is not in an array', ->
    @dummy.author = 'David'
    @dummy.isValid()
    expect(@dummy.errors.author).toBe undefined

  it 'supports i18n', ->
    App.Env.loco.setLocale 'pl'
    @dummy.isValid()
    expect(@dummy.errors.author[0]).toEqual "jest zarezerwowane"

  it 'supports custom message', ->
    dcm = new App.Models.DummyCustomMsg author: 'admin'
    dcm.isValid()
    expect(dcm.errors.author[0]).toEqual 'being an admin is not for u'

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
loco-rails-3.0.3 test/dummy/node_modules/loco-js/spec_coffee/loco/validators/exclusion_spec.coffee
loco-rails-3.0.2 test/dummy/node_modules/loco-js/spec_coffee/loco/validators/exclusion_spec.coffee
loco-rails-3.0.1 test/dummy/node_modules/loco-js/spec_coffee/loco/validators/exclusion_spec.coffee
loco-rails-3.0.0 test/dummy/node_modules/loco-js/spec_coffee/loco/validators/exclusion_spec.coffee