Sha256: 65846838e744c173d493d2dca244424268fbfe63a35aef0127fe0cea6b345ec1

Contents?: true

Size: 573 Bytes

Versions: 15

Compression:

Stored size: 573 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
        subject.valid?(1.0, {}).must_equal true
      end

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

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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
hermod-2.6.2 spec/hermod/validators/whole_units_spec.rb
hermod-2.6.1 spec/hermod/validators/whole_units_spec.rb
hermod-2.5.3 spec/hermod/validators/whole_units_spec.rb
hermod-2.5.2 spec/hermod/validators/whole_units_spec.rb
hermod-2.5.1 spec/hermod/validators/whole_units_spec.rb
hermod-2.5.0 spec/hermod/validators/whole_units_spec.rb
hermod-2.4.1 spec/hermod/validators/whole_units_spec.rb
hermod-2.4.0 spec/hermod/validators/whole_units_spec.rb
hermod-2.2.0 spec/hermod/validators/whole_units_spec.rb
hermod-2.1.0 spec/hermod/validators/whole_units_spec.rb
hermod-1.2.9 spec/hermod/validators/whole_units_spec.rb
hermod-1.2.8 spec/hermod/validators/whole_units_spec.rb
hermod-1.2.7 spec/hermod/validators/whole_units_spec.rb
hermod-1.2.6 spec/hermod/validators/whole_units_spec.rb
hermod-1.2.5 spec/hermod/validators/whole_units_spec.rb