Class: RiotMongoid::HasKeyAssertion
- Inherits:
-
Riot::AssertionMacro
- Object
- Riot::AssertionMacro
- RiotMongoid::HasKeyAssertion
- Defined in:
- lib/riot-mongoid/has_key.rb
Instance Method Summary collapse
Instance Method Details
#evaluate(model, *key_macro_info) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/riot-mongoid/has_key.rb', line 5 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 |