Sha256: aba229eee81da707f51f8219e3c4c29b8b0033e13639abb0aa0b668a7ed7171e

Contents?: true

Size: 940 Bytes

Versions: 3

Compression:

Stored size: 940 Bytes

Contents

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


{ :float => Float, :big_decimal => BigDecimal }.each do |column, type|
  describe "#{type} property" do
    before :all do
      SailBoat.auto_migrate!

      @model = SailBoat.new(:id => 1)
    end

    describe "with an integer value" do
      before :all do
        @model.attributes = {column => 1}
      end

      it_behaves_like "valid model"
    end

    describe "with a float value" do
      before :all do
        @model.attributes = {column => 1.0}
      end

      it_behaves_like "valid model"
    end

    describe "with a BigDecimal value" do
      before :all do
        @model.attributes = {column => BigDecimal('1')}
      end

      it_behaves_like "valid model"
    end

    describe "with an uncoercible value" do
      before :all do
        @model.attributes = {column => "foo"}
      end

      it_behaves_like "invalid model"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sbf-dm-validations-1.4.0 spec/integration/automatic_validation/inferred_float_property_validation_spec.rb
sbf-dm-validations-1.3.0 spec/integration/automatic_validation/inferred_float_property_validation_spec.rb
sbf-dm-validations-1.3.0.beta spec/integration/automatic_validation/inferred_float_property_validation_spec.rb