custom_matchers.rb 230 B

1234567
  1. # taken from https://makandracards.com/makandra/1080-rspec-matcher-to-check-if-an-activerecord-exists-in-the-database
  2. RSpec::Matchers.define :exist_in_database do
  3. match do |actual|
  4. actual.class.exists?(actual.id)
  5. end
  6. end