Sha256: 0221b45e0108d30bbf7540f8ba54e64074544140ef004cc8cea4df516187719e

Contents?: true

Size: 877 Bytes

Versions: 1

Compression:

Stored size: 877 Bytes

Contents

require 'spec_helper'

describe Thing do

  describe 'each validators' do

    describe 'without options' do

      it { should_not validate(:presence).of :field_a }
      it { should     validate(:presence).of :field_b }

      it { should_not validate(:numericality).of :field_c }

    end

    describe 'with options' do

      it { should_not validate(:numericality).of(:field_c).with only_integer: true }

      it { should validate(:numericality).of(:field_c).with only_integer: true, allow_nil: false }

    end

  end

  describe 'custom validations' do

    describe 'without options' do

      it { should validate :custom_validator }

    end

    describe 'with options' do

      it 'is not supported ' do
        -> { should validate(:custom_validator).with on: :update }.should raise_exception ValidationMatcher::UnexpectedOptions
      end

    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
validation_matcher-3.2.0 spec/thing_spec.rb