Sha256: 8d407b4515ab09f716f52b7e429a821740cbd7d9bd54c1897c42a235f145fc5b

Contents?: true

Size: 600 Bytes

Versions: 4

Compression:

Stored size: 600 Bytes

Contents

describe 'App.Validators.Presence', ->
  beforeEach ->
    @article = new App.Models.Article title: ''

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

  it 'validates length if object is a string', ->
    @article.isValid()
    expect(@article.errors.title[0]).toEqual "can't be blank"

  it 'supports i18n', ->
    App.Env.loco.setLocale 'pl'
    @article.isValid()
    expect(@article.errors.title[0]).toEqual "nie może być puste"

  it 'supports custom message', ->
    dcm = new App.Models.DummyCustomMsg title: null
    dcm.isValid()
    expect(dcm.errors.title[0]).toEqual 'presence is required'

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/presence_spec.coffee
loco-rails-3.0.2 test/dummy/node_modules/loco-js/spec_coffee/loco/validators/presence_spec.coffee
loco-rails-3.0.1 test/dummy/node_modules/loco-js/spec_coffee/loco/validators/presence_spec.coffee
loco-rails-3.0.0 test/dummy/node_modules/loco-js/spec_coffee/loco/validators/presence_spec.coffee