Sha256: 27ba7031cffc97f6b271fe2d98652c97d868dab0906b6c180a2bacff52e09607

Contents?: true

Size: 834 Bytes

Versions: 16

Compression:

Stored size: 834 Bytes

Contents

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

describe 'SailBoat', "with a :format option on a property" do
  before :all do
    SailBoat.auto_migrate!

    @model = SailBoat.new
    @model.should be_valid_for_format_test
  end

  describe "and value that matches the format" do
    before :all do
      @model.code = 'A1234'
    end

    it "passes inferred format validation" do
      @model.should be_valid_for_format_test
    end
  end

  describe "and value that DOES NOT match the format" do
    before :all do
      @model.code = 'BAD CODE'
    end

    it "does not pass inferred format validation" do
      @model.should_not be_valid_for_format_test
    end

    it "has a meaningful error message" do
      @model.errors.on(:code).should == [ 'Code has an invalid format' ]
    end
  end
end

Version data entries

16 entries across 16 versions & 3 rubygems

Version Path
ardm-validations-1.2.0 spec/integration/automatic_validation/inferred_format_validation_spec.rb
aequitas-0.0.1 spec_legacy/integration/automatic_validation/inferred_format_validation_spec.rb
dm-validations-1.2.0 spec/integration/automatic_validation/inferred_format_validation_spec.rb
dm-validations-1.2.0.rc2 spec/integration/automatic_validation/inferred_format_validation_spec.rb
dm-validations-1.2.0.rc1 spec/integration/automatic_validation/inferred_format_validation_spec.rb
dm-validations-1.1.0 spec/integration/automatic_validation/inferred_format_validation_spec.rb
dm-validations-1.1.0.rc3 spec/integration/automatic_validation/inferred_format_validation_spec.rb
dm-validations-1.1.0.rc2 spec/integration/automatic_validation/inferred_format_validation_spec.rb
dm-validations-1.1.0.rc1 spec/integration/automatic_validation/inferred_format_validation_spec.rb
dm-validations-1.0.2 spec/integration/automatic_validation/inferred_format_validation_spec.rb
dm-validations-1.0.1 spec/integration/automatic_validation/inferred_format_validation_spec.rb
dm-validations-1.0.0 spec/integration/automatic_validation/inferred_format_validation_spec.rb
dm-validations-1.0.0.rc3 spec/integration/automatic_validation/inferred_format_validation_spec.rb
dm-validations-1.0.0.rc2 spec/integration/automatic_validation/inferred_format_validation_spec.rb
dm-validations-1.0.0.rc1 spec/integration/automatic_validation/inferred_format_validation_spec.rb
dm-validations-0.10.2 spec/integration/automatic_validation/inferred_format_validation_spec.rb