Sha256: 7fabbcb34febda9628900d22e44bc791a6d30e8409c7db5db92fd455d9996f57
Contents?: true
Size: 449 Bytes
Versions: 7
Compression:
Stored size: 449 Bytes
Contents
module RiotMongoid class HasKeyAssertion < Riot::AssertionMacro register :has_key def evaluate(model, *key_macro_info) if key_macro_info.nil? fail("keys must be specified with this assertion macro") else valid = key_macro_info == model.primary_key key = key_macro_info.join('-') valid ? pass("#{model} has key #{key}") : fail("expected #{model} to have key #{key}") end end end end
Version data entries
7 entries across 7 versions & 1 rubygems