Sha256: 02c0c55fa6c2cce041b1ce88b98de7c7106d8de44854b39e75c97a2f2b02c792

Contents?: true

Size: 943 Bytes

Versions: 2

Compression:

Stored size: 943 Bytes

Contents

require 'spec_helper'
require 'integration/numeric_validator/spec_helper'

describe DataMapper::Validate::Fixtures::LerneanHydra do
  describe "with valid set of attributes" do
    before :all do
      @model = DataMapper::Validate::Fixtures::LerneanHydra.valid_instance
      @model.valid?
    end

    it_should_behave_like "valid model"
  end


  describe "with 9 heads" do
    before :all do
      @model = DataMapper::Validate::Fixtures::LerneanHydra.valid_instance(:head_count => 9)
      @model.valid?
    end

    it_should_behave_like "valid model"
  end


  describe "with only 3 heads" do
    before :all do
      @model = DataMapper::Validate::Fixtures::LerneanHydra.valid_instance(:head_count => 3)
      @model.valid?
    end

    it_should_behave_like "invalid model"

    it "has a meaningful error message" do
      @model.errors.on(:head_count).should == [ 'Lernean hydra is said to have exactly 9 heads' ]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dm-validations-0.10.1 spec/integration/numeric_validator/equality_with_integer_type_spec.rb
dm-validations-0.10.0 spec/integration/numeric_validator/equality_with_integer_type_spec.rb