otwarchive-sunsetarchive/spec/support/matchers/be_valid_verbose.rb
2026-03-17 01:16:49 -04:00

15 lines
351 B
Ruby
Executable file

RSpec::Matchers.define :be_valid_verbose do
match(&:valid?)
failure_message do |model|
"#{model.class} expected to be valid but had errors:n #{model.errors.full_messages.join('n ')}"
end
failure_message_when_negated do |model|
"#{model.class} expected to have errors, but it did not"
end
description do
"be valid"
end
end