jfirebaugh/konacha — pull request #164 by florish (2014-02-05 14:26:12+00:00)
Title: Extended metadata access for Example and ExampleGroup

On trying to get Konacha working with `yarjuf` JUnit spec output, I ran into some trouble due to differences in metadata handling for `Example` and `ExampleGroup` between RSpec and Konacha.

This PR is trying to address some of these issues, in particular:

* Merge `parent` metadata into Example and ExampleGroup metadata to allow metadata tree traversal up to root group
* Add `[]` Hash-like accessors to Example and ExampleGroup, delegating to instance method or metadata if no method exists
* Add `example_group` alias for `parent` on ExampleGroup (this was already implemented for Example, seemed to be missing)

Updates specs are included in each commit. I also tested this on an actual project with `konacha:run` and `konacha:serve` (with and without `yarjuf` JUnit reporting) and everything still seems to be running fine.

One thing I did notice, but decided on not to do, is a possibility for DRYing up some duplicate code between `Example` and `ExampleGroup`. The `initialize`, `update_metadata` and `[]` methods could be moved into a shared Module and could then be tested separately (instead of copying specs over between both of them). I'd be happy to add this upon request.