Sha256: 8a9b7c2331952c274f54ff5a22391f99e0c94f5ce62c20f6abf42028fb9878fc

Contents?: true

Size: 1.7 KB

Versions: 3

Compression:

Stored size: 1.7 KB

Contents

require_relative '../../spec_helper'
require_relative 'spec_helper'

describe 'DataMapper::Validations::Fixtures::BasketballCourt' do
  before :all do
    DataMapper::Validations::Fixtures::BasketballCourt.auto_migrate!
  end

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

    it_behaves_like 'valid model'
  end


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

    it_behaves_like 'valid model'
  end


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

    it_behaves_like 'invalid model'

    it "has a meaningful error message" do
      expect(@model.errors.on(:rim_height)).to eq [ '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::Validations::Fixtures::BasketballCourt.valid_instance(:free_throw_line_distance => 4.57)
      @model.valid?
    end

    it_behaves_like 'valid model'
  end


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

    it_behaves_like 'invalid model'

    it "has a meaningful error message" do
      expect(@model.errors.on(:free_throw_line_distance)).to eq [ 'Free throw line distance must be equal to 4.57' ]
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sbf-dm-validations-1.4.0 spec/integration/numeric_validator/equality_with_float_type_spec.rb
sbf-dm-validations-1.3.0 spec/integration/numeric_validator/equality_with_float_type_spec.rb
sbf-dm-validations-1.3.0.beta spec/integration/numeric_validator/equality_with_float_type_spec.rb