Sha256: 2d836f612e73704a4e68b979cbf0a2a501f489893cbb3735737c03b3156efdf1

Contents?: true

Size: 599 Bytes

Versions: 5

Compression:

Stored size: 599 Bytes

Contents

require "minitest_helper"

module Hermod
  module Validators
    describe WholeUnits do
      subject do
        WholeUnits.new
      end

      it "allows values that are in whole units" do
        expect(subject.valid?(1.0, {})).must_equal true
      end

      it "allows blank values" do
        expect(subject.valid?(nil, {})).must_equal true
      end

      it "raises an error for values with a fractional componant" do
        ex = expect { subject.valid?(3.1415, {}) }.must_raise InvalidInputError
        expect(ex.message).must_equal "must be in whole units"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hermod-3.3.0 spec/hermod/validators/whole_units_spec.rb
hermod-3.2.0 spec/hermod/validators/whole_units_spec.rb
hermod-3.0.0 spec/hermod/validators/whole_units_spec.rb
hermod-2.7.0 spec/hermod/validators/whole_units_spec.rb
hermod-2.7.0.pre.rc.1 spec/hermod/validators/whole_units_spec.rb