Sha256: 22e0dd97bbedba89db31d7dcd02739585e68467efa9b97ffa325d456558c5d50

Contents?: true

Size: 704 Bytes

Versions: 3

Compression:

Stored size: 704 Bytes

Contents

require 'spec_helper'

describe 'Yema::Virtus::Rule::Inclusion' do

  subject { described_class.new(age: value).errors }

  let(:described_class) do
    Class.new do
      include Yema::Virtus::Validations
      attribute :age, Integer, strict: :none, within: 1..5
      self
    end
  end

  it_behaves_like "valid resource", 1
  it_behaves_like "valid resource", 3
  it_behaves_like "valid resource", 5

  it_behaves_like "invalid resource", 0
  it_behaves_like "invalid resource", 6
  it_behaves_like "invalid resource", "3a"
  it_behaves_like "invalid resource", "abc"
  it_behaves_like "invalid resource", false
  it_behaves_like "invalid resource", nil
  it_behaves_like "invalid resource", ""
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
yema-0.0.3 spec/integration/virtus/inclusion_spec.rb
yema-0.0.2 spec/integration/virtus/inclusion_spec.rb
yema-0.0.1 spec/integration/virtus/inclusion_spec.rb