psyho / bogus

Fake library for Ruby
Other
359 stars 14 forks source link

Saner keyword arguments support #6

Closed chastell closed 11 years ago

chastell commented 11 years ago

Apologies for the previous implementation, it worked more by accident than anything else (it required the existence of a method named the same was as the argument, which happened to be the case in all of my specs…).

This allows the kwargs to be anything, which is still sub-optimal¹, but better than what’s on master at the moment.

¹ ideally, the stringifier would default them to their actual default values – but I failed to find a stable way to do it with the method_source gem; the other idea was to parse Ripper.sexp output fed with Method#source_location, but that might be more work than it’s worth ;)

coveralls commented 11 years ago

Coverage Status

Coverage remained the same when pulling f36d436a5a8fa3c59d54bb66f7f94f9753c6e7a2 on chastell:saner_keyword_arguments into 6945a0be150f273e4b69c4733fb62dbe056c3636 on psyho:master.

chastell commented 11 years ago

Gaah, this (obviously, when I think about it…) allows passing any arguments as kwarg values and makes have_received happy as a clam every time. Not sure what’s worse, though, current master (blows up unless there’s a same-named method in scope) or this (always happy and not really verifying anything).

chastell commented 11 years ago

No, on further exploration this PR doesn’t make much sense; apologies!