Sha256: e785c6fa288433c2507908e2c1d01fc7e43719c047196d5ea46b6d92155035f2

Contents?: true

Size: 593 Bytes

Versions: 1

Compression:

Stored size: 593 Bytes

Contents

# spec/support/shared_examples/validation_examples.rb
RSpec.shared_examples "validates attributes" do |attributes|
  attributes.each do |attribute, valid_values|
    context "with #{attribute}" do
      it "accepts valid values" do
        valid_values.each do |value|
          expect do
            described_class.new(attribute => value)
          end.not_to raise_error
        end
      end

      it "rejects invalid values" do
        expect do
          described_class.new(attribute => "invalid")
        end.to raise_error(Lutaml::Model::ValidationError)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
oasis-etm-0.1.0 spec/support/shared_examples/validation_examples.rb