Sha256: fd719d211dfa9cd5ced0b15eba55cfcc8de788ad9063f1cf7ed809a91d951341

Contents?: true

Size: 521 Bytes

Versions: 2

Compression:

Stored size: 521 Bytes

Contents

require 'spec_helper.rb'

RSpec.describe "aliases" do

  it "Validates with aliased rules" do
    validator = LIVR::Validator.new({
        "password" => ["required", "strong_password"]
      })
    validator.register_aliased_rule({
      "name" => 'strong_password',
      "rules" => { "min_length" => 6 },
      "error" => 'WEAK_PASSWORD'
    })


    output = validator.validate({ "password" => "abc" })
    expect(output).to eq(false)
    expect(validator.get_errors).to eq({"password" => "WEAK_PASSWORD"})
  end

end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
ruby-livr-2.0.0 spec/02-aliases_spec.rb
livr2-2.0.0 spec/02-aliases_spec.rb