Sha256: 2c629259418881eea35a010617ddd53488940453130febc876c419c025177dcd

Contents?: true

Size: 713 Bytes

Versions: 4

Compression:

Stored size: 713 Bytes

Contents

require 'rspec'
begin
  require 'active_model'
rescue LoadError => err
  puts "Running specs without active_model extension"
end

$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'license_plate_validator'

if defined?(ActiveModel)
  class ModelBase
    include ActiveModel::Serialization
    include ActiveModel::Validations

    attr_accessor :attributes

    def initialize(attributes = {})
      @attributes = attributes
    end

    def read_attribute_for_validation(key)
      @attributes[key.to_sym]
    end

    def method_missing(method_name, *args, &block)
      return super unless @attributes.keys.any? { |k| k == method_name }
      @attributes[method_name.to_sym]
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
license_plate_validator-2.0.0 spec/spec_helper.rb
license_plate_validator-1.2.0 spec/spec_helper.rb
license_plate_validator-1.1.1 spec/spec_helper.rb
license_plate_validator-1.1.0 spec/spec_helper.rb