Sha256: 4c6d27c1dc38fffc9304b7a5a58b3e8f07befda2c92413765a1380492dc0e9c3
Contents?: true
Size: 658 Bytes
Versions: 2
Compression:
Stored size: 658 Bytes
Contents
# frozen_string_literal: true RSpec.describe ActiveRecord::Validations::PgEnumValidator, :unit do subject { Shirt.create(name: 'Plain Shirt', size: :medium) } it 'passes validation when using supported values' do %i[small medium large].each do |size| expect(subject.update(size: size)).to eq(true) expect(subject).to be_valid end end it 'fails validation when using an unsupported value' do expect(subject.update(size: :other)).to eq(false) expect(subject).not_to be_valid end it 'fails validation when using nil' do expect(subject.update(size: nil)).to eq(false) expect(subject).not_to be_valid end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
enum_kit-0.3.1 | spec/active_record/validations/pg_enum_validator_spec.rb |
enum_kit-0.3.0 | spec/active_record/validations/pg_enum_validator_spec.rb |