Sha256: 49ce7c142c337011c64c9dce5f51e20d21a5f87e23a3efa81431b0ddc7224e5c

Contents?: true

Size: 1.21 KB

Versions: 6

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'
require 'integration/automatic_validation/spec_helper'

describe "A class with inferred validations disabled for all properties with an option" do
  before :all do
    @klass = Class.new do
      include DataMapper::Resource

      property :id,   DataMapper::Property::Serial,                     :auto_validation => false
      property :name, String,                        :required => true, :auto_validation => false
      property :bool, DataMapper::Property::Boolean, :required => true, :auto_validation => false
    end

    @model = @klass.new
  end

  describe "when instantiated w/o any attributes" do
    it_should_behave_like "valid model"
  end
end


describe "A class with inferred validations disabled for all properties with a block" do
  before :all do
    @klass = Class.new do
      include DataMapper::Resource

      without_auto_validations do
        property :id,   DataMapper::Property::Serial
        property :name, String,                        :required => true
        property :bool, DataMapper::Property::Boolean, :required => true
      end
    end

    @model = @klass.new
  end

  describe "when instantiated w/o any attributes" do
    it_should_behave_like "valid model"
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dm-validations-1.1.0 spec/integration/automatic_validation/disabling_inferred_validation_spec.rb
dm-validations-1.1.0.rc3 spec/integration/automatic_validation/disabling_inferred_validation_spec.rb
dm-validations-1.1.0.rc2 spec/integration/automatic_validation/disabling_inferred_validation_spec.rb
dm-validations-1.1.0.rc1 spec/integration/automatic_validation/disabling_inferred_validation_spec.rb
dm-validations-1.0.2 spec/integration/automatic_validation/disabling_inferred_validation_spec.rb
dm-validations-1.0.1 spec/integration/automatic_validation/disabling_inferred_validation_spec.rb