logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

model_have_error_on_field.rb (315B)


  1. RSpec::Matchers.define :model_have_error_on_field do |expected|
  2. match do |record|
  3. if record.errors.empty?
  4. record.valid?
  5. end
  6. record.errors.has_key?(expected)
  7. end
  8. failure_message do |record|
  9. keys = record.errors.keys
  10. "expect record.errors(#{keys}) to include #{expected}"
  11. end
  12. end