Sha256: f9dbfb21fe5bbc8aa50eae361db2c7bdf0d2434102f0dd6084289d4840bf4a67
Contents?: true
Size: 655 Bytes
Versions: 5
Compression:
Stored size: 655 Bytes
Contents
require "minitest_helper" module Hermod module Validators describe NonNegative do subject do NonNegative.new end it "allows positive values" do expect(subject.valid?(1, {})).must_equal true end it "allows zero values" do expect(subject.valid?(0, {})).must_equal true end it "allows blank values" do expect(subject.valid?(nil, {})).must_equal true end it "raises an error for negative values" do ex = expect { subject.valid?(-1, {}) }.must_raise InvalidInputError expect(ex.message).must_equal "cannot be negative" end end end end
Version data entries
5 entries across 5 versions & 1 rubygems