Module: Longleaf::ConfigValidatorHelpers

Defined in:
lib/longleaf/specs/config_validator_helpers.rb

Instance Method Summary collapse

Instance Method Details

#fails_validation_with_error(validator, *error_messages) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/longleaf/specs/config_validator_helpers.rb', line 3

def fails_validation_with_error(validator, *error_messages)
  result = validator.validate_config
  expect(result.valid?).to be false
  error_messages.each do |error_message|
    expect(result.errors).to include(error_message)
  end
end

#passes_validation(validator) ⇒ Object



11
12
13
14
# File 'lib/longleaf/specs/config_validator_helpers.rb', line 11

def passes_validation(validator)
  result = validator.validate_config
  expect(result.valid?).to eq(true), "expected validation to pass, but received errors:\n#{result.errors&.join("\n")}"
end