[LRUG] Riot assertions

Kevin Fullerton lrug at kenwa-solutions.co.uk
Tue Aug 27 06:08:59 PDT 2013


I've been playing around with padrino lately, and using riot for 
testing - I've found a riot-mongo_mapper project which defines some 
macros to help with testing mongo_mapper models with riot, I've forked 
and updated it to the latest riot/mongo_mapper as it hadn't been updated 
in 2 years and was out of date for versions, however I can't work out 
why one of the macros works, but one doesn't - they both seem to be 
defined the same way, one works OK but the other throws a "wrong number 
of arguments (2 for 1)" error and I can't see why ...

I've put a test repository up at 
https://github.com/kgfullerton/padrino-test which shows what's happening 
with the 2 assertion macros (in test/models/user_test.rb - the 
has_validation macro works, the has_key one doesn't) which can be seen 
just by running `rake test` with the gems installed.

The relevant places that these validations are defined are (I believe) 
https://github.com/kgfullerton/riot-mongo_mapper/blob/master/lib/riot-mongo_mapper/has_key.rb#L5 
and 
https://github.com/kgfullerton/riot-mongo_mapper/blob/master/lib/riot-mongo_mapper/has_validation.rb#L5

If anyone can point me in the right direction of why it's failing that 
would be very much appreciated! :)

-- 
Kevin Fullerton



More information about the Chat mailing list