Sha256: 7c86924b8cf3fba2a045fc29946ae5354f627cb795f22bcc00d181d8b0bc4e04

Contents?: true

Size: 636 Bytes

Versions: 1

Compression:

Stored size: 636 Bytes

Contents

require 'spec_helper'

describe "CoolValidator" do
  context "handling errors" do

    before do
      @validator = Kharon::CoolValidator.new({key: "value"})
    end

    it "doesn't raise an exception when an error occurs" do
      expect(->{@validator.any(:another, required: true)}).to_not raise_error
    end

    it "has an error when an error has occured" do
      @validator.any(:another, required: true)
      expect(@validator.has_errors?).to be(true)
    end

    it "doesn't have an error when none has occured" do
      @validator.any(:key, required: true)
      expect(@validator.has_errors?).to be(false)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kharon-0.3.1 spec/lib/cool_validator_spec.rb