Sha256: 2f4204798c00f6305f1cd3f641ff66daf4d8223e161840339ff192bd12f90602

Contents?: true

Size: 1.62 KB

Versions: 2

Compression:

Stored size: 1.62 KB

Contents

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

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

    it_should_behave_like "valid model"
  end


  describe "with rim height of 3.05" do
    before :all do
      @model = DataMapper::Validate::Fixtures::BasketballCourt.valid_instance(:rim_height => 3.05)
      @model.valid?
    end

    it_should_behave_like "valid model"
  end


  describe "with rim height of 3.30" do
    before :all do
      @model = DataMapper::Validate::Fixtures::BasketballCourt.valid_instance(:rim_height => 3.30)
      @model.valid?
    end

    it_should_behave_like "invalid model"

    it "has a meaningful error message" do
      @model.errors.on(:rim_height).should == [ 'Rim height must be equal to 3.05' ]
    end
  end


  describe "with free throw line distance of 4.57" do
    before :all do
      @model = DataMapper::Validate::Fixtures::BasketballCourt.valid_instance(:free_throw_line_distance => 4.57)
      @model.valid?
    end

    it_should_behave_like "valid model"
  end


  describe "with free throw line distance of 3.10" do
    before :all do
      @model = DataMapper::Validate::Fixtures::BasketballCourt.valid_instance(:free_throw_line_distance => 3.10)
      @model.valid?
    end

    it_should_behave_like "invalid model"

    it "has a meaningful error message" do
      @model.errors.on(:free_throw_line_distance).should == [ 'Free throw line distance must be equal to 4.57' ]
    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_float_type_spec.rb
dm-validations-0.10.0 spec/integration/numeric_validator/equality_with_float_type_spec.rb