Sha256: 798f06416f191255211da858829d0224bc44b3ad30d094dfa795b19f8cede8b1
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true libs = %w[ active_model active_support/core_ext pry rspec validation_matcher ] libs.each { |lib| require lib } RSpec.configure do |config| Kernel.srand config.seed config.filter_run :focus config.order = :random config.run_all_when_everything_filtered = true config.expect_with :rspec do |expectations| expectations.include_chain_clauses_in_custom_matcher_descriptions = true expectations.syntax = :should end config.mock_with :rspec do |mocks| mocks.verify_partial_doubles = true mocks.syntax = :should end end class Thing extend ActiveModel::Naming include ActiveModel::Conversion include ActiveModel::Validations attr_accessor :field_a, :field_b, :field_c validates :field_b, presence: true validates :field_c, numericality: { allow_nil: false, only_integer: true } validate :custom_validator validate :another_custom_validator, on: :update validate :procs_cannot_be_speced, if: -> { new_record? } private def custom_validator errors[:base] << 'Field A should be false-y' if field_a end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
validation_matcher-4.0.0 | spec/spec_helper.rb |