Sha256: 0f0effcf5e98f849b4da9379f89183b52fb1f08c8034d867c0da54f9fe519208

Contents?: true

Size: 725 Bytes

Versions: 4

Compression:

Stored size: 725 Bytes

Contents

module DataMapper
  module Validation
    module Fixtures
      class Barcode
        attr_accessor :valid_hook_call_count

        #
        # Behaviors
        #

        include DataMapper::Resource

        #
        # Properties
        #

        without_auto_validations do
          property :code, String, :key => true
        end

        #
        # Validations
        #

        validates_length_of :code, :max => 10

        def self.valid_instance
          new(:code => "3600029145")
        end

        # measure the number of times #valid? is executed
        before :valid? do
          @valid_hook_call_count ||= 0
          @valid_hook_call_count += 1
        end

      end # Barcode
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
sbf-dm-validations-1.4.0 spec/fixtures/barcode.rb
sbf-dm-validations-1.3.0 spec/fixtures/barcode.rb
sbf-dm-validations-1.3.0.beta spec/fixtures/barcode.rb
aequitas-0.0.1 spec_legacy/fixtures/barcode.rb