rspec/rspec-core — Issue #484: Odd Metadata Hash Behavior
Author: ryanb
Created: 2011-10-21 17:20:08+00:00
State: open

I love how one can access the `metadata` from an example, but I find it has some odd behavior when treating as a hash. I ran into this when attempting to call `slice` on it which is a method ActiveSupports adds for extracting out a hash given a set of keys.

```ruby
example.metadata.slice(:record, :match_requests_on)
```

This returns a new Metadata hash but it includes the `:example_group` key as well. Internally Rails is creating a new metadata object and appending the given keys/values to it. I'm assuming the `:example_group` option is added automatically when creating a new metadata hash. Any chance to change this behavior so `example_groups` isn't added upon instantiating the metadata? Either that or provide a nice `to_hash` method for converting the metadata to a simple hash.