Sha256: 927b4624ad31f50f812fd7a106bfe149c3f56458487cd6e0848f029667284961

Contents?: true

Size: 576 Bytes

Versions: 3

Compression:

Stored size: 576 Bytes

Contents

require "minitest_helper"

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

      it "doesn't implement a test" do
        expect { subject.valid?(nil, {}) }.must_raise NotImplementedError
      end

      it "has a default error message" do
        class TestValidator < Base
          def test(value, attributes)
            false
          end
        end
        ex = expect { TestValidator.new.valid?(nil, {}) }.must_raise InvalidInputError
        expect(ex.message).must_equal "is invalid"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hermod-3.0.0 spec/hermod/validators/base_spec.rb
hermod-2.7.0 spec/hermod/validators/base_spec.rb
hermod-2.7.0.pre.rc.1 spec/hermod/validators/base_spec.rb