Sha256: 4b837f3449debaab90ab9885b18ba6a965cb93d9efb8a7fcc61f519726293807

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

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

describe 'DataMapper::Validate::Fixtures::LerneanHydra' do
  before :all do
    DataMapper::Validate::Fixtures::LerneanHydra.auto_migrate!
  end

  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

1 entries across 1 versions & 1 rubygems

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