Sha256: 76e6f01e82899ee675c16bd8cf0dfef47b4089da71ef45ce7333d337fd29f916

Contents?: true

Size: 804 Bytes

Versions: 2

Compression:

Stored size: 804 Bytes

Contents

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

describe SailBoat, "with a :format option on a property" do
  before :all do
    @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

2 entries across 2 versions & 1 rubygems

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