Hey so the gem does not work under RSpec 3. It has to do with example being yielded into blocks instead of immediately available on the file itself.
I am looking into it but if you have any suggestions I am all ears.
The line that goes wrong is the following:
# /Users/mhenrixon/code/github/approvals/lib/approvals/extensions/rspec/dsl.rb:12:in 'verify'
I never actually use the RSpec integration -- it was a hack that I messed around with a couple years back. I'd have to go dig around in the RSpec 3 source code to see how they've organised things. Unfortunately, I don't think I have time to look at it for the next few weeks.
I am thinking of removing it (or at least moving it into a plugin) when I prepare the gem for v1.0.
I depend pretty much on the rspec functionality, so I'd rather keep it. Perfectly willing to invest some time in making it compatible, as I want to switch to rspec 3 as soon as it's there as well. The code is small enough that this shouldn't be too much work.
@marten you did some investigation into why this failed as well, did you find something?
Yes, group.example is gone in RSpec 3. If you want it, you can either use RSpec.current_example or you have capture it explicitly: it 'foo' do |example|. Neither of those are available in older RSpec versions, so you'll have to add a version check and switch behaviour based on that.
it 'foo' do |example|
After figuring that out, my 2 minute timer for "let's see if this RSpec test would be cleaner using Approvals" was up, and I didn't pursue it further.
I'm currently working on upgrading to 2.99. One thing I noticed is what rspec suggests:
RSpec::Core::ExampleGroup#example is deprecated and will be removed
in RSpec 3. There are a few options for what you can use instead:
RSpec.configure do |c|
This sounds like a decent workaround, if you want to upgrade to 3 now, and have approvals.
Ok, my pullrequest should fix it. It runs without deprecation warnings on 2.99, and @marten verified that it works on 3.0 for him.
If we want to test this properly, we need to do a little more effort. We currently have one test suite, which tests (at least) two things: whether our code works, and whether code which uses approvals work.
If we want to test in both rspec 2 and 3, we need to test the latter using appraisals, but we cannot do so with the first (you cannot have a spec which works in both 2.14 and 3.0, unless you're willing to sacrifice a lot of syntax). This seemed a lot of effort for now, but eventually I think we'd want that.