Sha256: d0f45922dfcd6a6c05550af81a85be324aaafce746992b95c8e377f3f457e862

Contents?: true

Size: 647 Bytes

Versions: 27

Compression:

Stored size: 647 Bytes

Contents

# frozen_string_literal: true
# encoding: utf-8

require "spec_helper"

describe ActiveModel::Validations::NumericalityValidator do

  describe "#validate_each" do

    before(:all) do
      class TestModel
        include Mongoid::Document
        field :amount, type: BigDecimal
        validates_numericality_of :amount, allow_blank: false
      end
    end

    after(:all) do
      Object.send(:remove_const, :TestModel)
    end

    context "when the value is non numeric" do

      let(:model) do
        TestModel.new(amount: "asdf")
      end

      it "returns false" do
        expect(model).to_not be_valid
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
mongoid-7.3.5 spec/mongoid/validatable/numericality_spec.rb
mongoid-7.3.4 spec/mongoid/validatable/numericality_spec.rb
mongoid-7.1.11 spec/mongoid/validatable/numericality_spec.rb
mongoid-7.2.6 spec/mongoid/validatable/numericality_spec.rb
mongoid-7.3.3 spec/mongoid/validatable/numericality_spec.rb
mongoid-7.3.2 spec/mongoid/validatable/numericality_spec.rb
mongoid-7.2.5 spec/mongoid/validatable/numericality_spec.rb
mongoid-7.1.10 spec/mongoid/validatable/numericality_spec.rb
mongoid-7.1.9 spec/mongoid/validatable/numericality_spec.rb
mongoid-7.2.4 spec/mongoid/validatable/numericality_spec.rb
mongoid-7.3.1 spec/mongoid/validatable/numericality_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/mongoid-7.1.7/spec/mongoid/validatable/numericality_spec.rb
mongoid-7.3.0 spec/mongoid/validatable/numericality_spec.rb
mongoid-7.2.3 spec/mongoid/validatable/numericality_spec.rb
mongoid-7.1.8 spec/mongoid/validatable/numericality_spec.rb
mongoid-7.2.2 spec/mongoid/validatable/numericality_spec.rb
mongoid-7.2.1 spec/mongoid/validatable/numericality_spec.rb
mongoid-7.1.7 spec/mongoid/validatable/numericality_spec.rb
mongoid-7.2.0 spec/mongoid/validatable/numericality_spec.rb
mongoid-7.1.6 spec/mongoid/validatable/numericality_spec.rb