trabajo-afectivo/spec/support/custom_matchers.rb

8 lines
230 B
Ruby
Raw Normal View History

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