Sha256: b63d9b557445c1956cd209bc95758c1b657307983b77ed92eccf15e7139dbdb7

Contents?: true

Size: 629 Bytes

Versions: 25

Compression:

Stored size: 629 Bytes

Contents

# frozen_string_literal: true

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

25 entries across 25 versions & 1 rubygems

Version Path
mongoid-8.1.8 spec/mongoid/validatable/numericality_spec.rb
mongoid-8.1.7 spec/mongoid/validatable/numericality_spec.rb
mongoid-8.1.6 spec/mongoid/validatable/numericality_spec.rb
mongoid-8.0.8 spec/mongoid/validatable/numericality_spec.rb
mongoid-8.1.5 spec/mongoid/validatable/numericality_spec.rb
mongoid-8.1.4 spec/mongoid/validatable/numericality_spec.rb
mongoid-8.0.7 spec/mongoid/validatable/numericality_spec.rb
mongoid-8.1.3 spec/mongoid/validatable/numericality_spec.rb
mongoid-8.1.2 spec/mongoid/validatable/numericality_spec.rb
mongoid-8.0.6 spec/mongoid/validatable/numericality_spec.rb
mongoid-7.5.4 spec/mongoid/validatable/numericality_spec.rb
mongoid-8.1.1 spec/mongoid/validatable/numericality_spec.rb
mongoid-8.0.5 spec/mongoid/validatable/numericality_spec.rb
mongoid-8.1.0 spec/mongoid/validatable/numericality_spec.rb
mongoid-7.5.3 spec/mongoid/validatable/numericality_spec.rb
mongoid-8.0.4 spec/mongoid/validatable/numericality_spec.rb
mongoid-8.0.3 spec/mongoid/validatable/numericality_spec.rb
mongoid-7.5.2 spec/mongoid/validatable/numericality_spec.rb
mongoid-8.0.2 spec/mongoid/validatable/numericality_spec.rb
mongoid-7.5.1 spec/mongoid/validatable/numericality_spec.rb