Sha256: 99698543df420348ee73fff084e93897f7c573a05191c75ab9fe148cee5058c9

Contents?: true

Size: 475 Bytes

Versions: 2

Compression:

Stored size: 475 Bytes

Contents

require 'spec_helper'

describe Valcro::Runner do
  it 'can store validators' do
    runner = Valcro::Runner.new
    runner.add_validator :some_validator
    expect(runner.validators).to have(1).validator
  end

  it 'runs validators' do
    error_list = Valcro::ErrorList.new
    runner     = Valcro::Runner.new(error_list)
    runner.add_validator lambda { |errors| errors.add :foo, 'Huge mistake' }

    runner.validate

    expect(error_list.any?).to be_truthy
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
valcro-0.2.0 spec/runner_spec.rb
valcro-0.1.1 spec/runner_spec.rb