Sha256: 5cc3630cff09501c3c7a7c7a43f97c613bf25f52fd15b5a17235b750fe5f7984

Contents?: true

Size: 587 Bytes

Versions: 4

Compression:

Stored size: 587 Bytes

Contents

describe 'Custom validators', ->
  afterEach -> App.Env.loco.setLocale 'en'

  it 'allows to define custom validators', ->
    comment = new App.Models.Article.Comment text: 'Some nice words + FUCK at the end.'
    expect(comment.isInvalid()).toBe true
    expect(comment.errors.text[0]).toEqual 'contains strong language.'

  it 'supports i18n', ->
    App.Env.loco.setLocale 'pl'
    comment = new App.Models.Article.Comment text: 'Trochę ciepłych słów + KuRwA na końcu.'
    expect(comment.isInvalid()).toBe true
    expect(comment.errors.text[0]).toEqual 'zawiera mocny język.'

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