Sha256: c071e6a2ff2a2ba7dc6c1b570d0af7ec25dcdb4b14b59a9c5ff177746173a49a

Contents?: true

Size: 574 Bytes

Versions: 5

Compression:

Stored size: 574 Bytes

Contents

require "minitest_helper"

module Hermod
  module Validators
    describe Attributes do
      subject do
        Attributes.new([:species, :genus])
      end

      it "permits attributes in the list" do
        expect(subject.valid?(nil, {species: "Felis catus", genus: "Felis"})).must_equal true
      end

      it "raises an error for attributes not in the list" do
        ex = expect { subject.valid?(nil, {phylum: "Chordata"}) }.must_raise InvalidInputError
        expect(ex.message).must_equal "has attributes it doesn't accept: phylum"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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