Sha256: 67e7938d6f4ce7dbd3590d68f4282b30324900cffc4b11f29f69a67795cd76da

Contents?: true

Size: 490 Bytes

Versions: 5

Compression:

Stored size: 490 Bytes

Contents

require "minitest_helper"

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

      it "allows values that are present" do
        expect(subject.valid?(1, {})).must_equal true
      end

      it "raises an error for missing values" do
        ex = expect { subject.valid?(nil, {}) }.must_raise InvalidInputError
        expect(ex.message).must_equal "isn't optional but no value was provided"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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