Sha256: c0d743a00ed95a36b8c6504bd74d7d2c34570a31a5206b2e7f6bcda346761bbc

Contents?: true

Size: 895 Bytes

Versions: 2

Compression:

Stored size: 895 Bytes

Contents

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

describe SailBoat do
  before :all do
    @model      = SailBoat.new(:id => 1)
    @model.name = 'Float'
    @model.should be_valid_for_presence_test
  end

  describe "without name" do
    before :all do
      @model.name = nil
    end

    # has validates_is_present for name thanks to :nullable => false
    it "is invalid" do
      @model.should_not be_valid_for_presence_test
      @model.errors.on(:name).should == [ 'Name must not be blank' ]
    end
  end
end



describe SailBoat do
  before :all do
    @model      = SailBoat.new(:id => 1)
    @model.name = 'Float'
    @model.should be_valid_for_presence_test
  end

  describe "with a name" do
    before :all do
      # no op
    end

    # has validates_is_present for name thanks to :nullable => false
    it_should_behave_like "valid model"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dm-validations-0.10.1 spec/integration/automatic_validation/inferred_presence_validation_spec.rb
dm-validations-0.10.0 spec/integration/automatic_validation/inferred_presence_validation_spec.rb