ghempton / camcorder

VCR not enough? Record arbitrary method invocations for later playback.
MIT License
86 stars 10 forks source link

Using :example_group from metadata is deprecated warning [Rspec] #8

Closed etagwerker closed 8 years ago

etagwerker commented 8 years ago

Hey @ghempton!

Thank you for developing this gem! It's been very useful so far. :+1:

The only issue that I've found is that it shows this warning:

Deprecation Warnings:

The `:example_group` key in an example group's metadata hash is deprecated. Use the example group's hash directly for the computed keys and `:parent_example_group` to access the parent example group metadata instead. Called from /Users/etagwerker/.rvm/gems/ruby-2.2.1@sender/gems/camcorder-0.0.4/lib/camcorder/rspec.rb:9:in `yield'.

If you need more of the backtrace for any of these deprecations to
identify where to make the necessary changes, you can configure
`config.raise_errors_for_deprecations!`, and it will turn the
deprecation warnings into errors, giving you the full backtrace.

1 deprecation warning total

This happens because Rspec has deprecated the usage of metadata[:example_group] - See: https://github.com/rspec/rspec-rails/issues/1035

I tried to write a PR to fix this but I couldn't find a decent way to keep the current tree structure for the recordings.

Instead of using the recursive code that generates the nested folder, I could write an implementation that uses metadata[:full_description] to generate the recording file. The problem with this solution is that it wouldn't be backwards compatible. :(

What do you think?

Thanks!

ghempton commented 8 years ago

Thanks for looking into this. I would suggest looking at vcr's implementation of this (on which this recursive code was originally based). I bet they have found the right way around it.

etagwerker commented 8 years ago

@ghempton Done! Vcr's current implementation doesn't generate this warning. Here is the PR ^

blainejohnson17 commented 8 years ago

@ghempton, can you cut a new version on ruby gems which includes this change?

ghempton commented 8 years ago

Sure

ghempton commented 8 years ago

Just pushed 0.0.5

blainejohnson17 commented 8 years ago

Thanks !