Skip to content
This repository has been archived by the owner on Feb 27, 2019. It is now read-only.

Use RSpec 3 method of getting parent example group #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

grk
Copy link

@grk grk commented Nov 21, 2014

From rspec/rspec-core#1391 the method of extracting parent example group changed.

In latest 3.1.x it started causing the return code to be 1, breaking all specs.

@ryanong
Copy link

ryanong commented Jan 23, 2015

👍

2 similar comments
@isaacseymour
Copy link

👍

@mickey
Copy link

mickey commented Feb 18, 2015

👍

@marcomorain
Copy link

Hi @grk – how will this affect people using older versions of rspec? Would it make sense to check both :example_group and :parent_example_group? Or change the symbol based on the version of rpsec being used?

@mickey
Copy link

mickey commented Feb 18, 2015

You can get the rspec version via RSpec::Version::STRING (works in version 2 and 3 of rspec)

@grk
Copy link
Author

grk commented Feb 18, 2015

Hm, looks like travis didn't run on this PR. Perhaps the tests should run on circle? :)

@grk
Copy link
Author

grk commented Feb 18, 2015

https://github.com/thoughtbot/appraisal could be useful for generating those gemfiles

@kylev
Copy link

kylev commented Feb 23, 2015

It should work fine as is. The rename to :parent_example_group name came about in 3.0 and the :example_group should now be deprecated.

A few versions of rspec-core caused some regressions, but those were only briefly alive or RC versions that most people won't be on.

@kylev
Copy link

kylev commented Feb 26, 2015

Actually, this doesn't seem to do the right thing, nor can I repro your problem. This repo currently traverses :example_group to find the example group a shared example runs within. I'm not sure what this patch causes to happen, but is isn't that...

Can you provide more detail, @grk?

@jankeesvw
Copy link

Can you guys merge this? This problem gives me a broken build:

> bundle exec rspec --format RspecJunitFormatter  --out rspec.xml                                                                                                                                                      
/Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.2.3/lib/rspec/core/formatters/deprecation_formatter.rb:187:in `puts': 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/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/bundler/gems/rspec_junit_formatter-7b098c8ab2ac/lib/rspec_junit_formatter/rspec3.rb:48:in `yield'. (RSpec::Core::DeprecationError)
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.2.3/lib/rspec/core/formatters/deprecation_formatter.rb:126:in `print_deprecation_message'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.2.3/lib/rspec/core/formatters/deprecation_formatter.rb:37:in `deprecation'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.2.3/lib/rspec/core/reporter.rb:146:in `block in notify'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.2.3/lib/rspec/core/reporter.rb:145:in `each'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.2.3/lib/rspec/core/reporter.rb:145:in `notify'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.2.3/lib/rspec/core/reporter.rb:116:in `deprecation'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.2.3/lib/rspec/core/warnings.rb:11:in `deprecate'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.2.3/lib/rspec/core/metadata.rb:266:in `block in backwards_compatibility_default_proc'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/bundler/gems/rspec_junit_formatter-7b098c8ab2ac/lib/rspec_junit_formatter/rspec3.rb:48:in `yield'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/bundler/gems/rspec_junit_formatter-7b098c8ab2ac/lib/rspec_junit_formatter/rspec3.rb:48:in `example_group_file_path_for'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/bundler/gems/rspec_junit_formatter-7b098c8ab2ac/lib/rspec_junit_formatter/rspec3.rb:55:in `classname_for'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/bundler/gems/rspec_junit_formatter-7b098c8ab2ac/lib/rspec_junit_formatter.rb:55:in `xml_dump_example'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/bundler/gems/rspec_junit_formatter-7b098c8ab2ac/lib/rspec_junit_formatter.rb:34:in `xml_dump_passed'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/bundler/gems/rspec_junit_formatter-7b098c8ab2ac/lib/rspec_junit_formatter.rb:29:in `block in xml_dump_examples'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/bundler/gems/rspec_junit_formatter-7b098c8ab2ac/lib/rspec_junit_formatter.rb:28:in `each'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/bundler/gems/rspec_junit_formatter-7b098c8ab2ac/lib/rspec_junit_formatter.rb:28:in `xml_dump_examples'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/bundler/gems/rspec_junit_formatter-7b098c8ab2ac/lib/rspec_junit_formatter.rb:23:in `block in xml_dump'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `call'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `_nested_structures'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/builder-3.2.2/lib/builder/xmlbase.rb:68:in `tag!'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/builder-3.2.2/lib/builder/xmlbase.rb:93:in `method_missing'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/bundler/gems/rspec_junit_formatter-7b098c8ab2ac/lib/rspec_junit_formatter.rb:21:in `xml_dump'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/bundler/gems/rspec_junit_formatter-7b098c8ab2ac/lib/rspec_junit_formatter/rspec3.rb:19:in `dump_summary'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.2.3/lib/rspec/core/reporter.rb:146:in `block in notify'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.2.3/lib/rspec/core/reporter.rb:145:in `each'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.2.3/lib/rspec/core/reporter.rb:145:in `notify'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.2.3/lib/rspec/core/reporter.rb:130:in `finish'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.2.3/lib/rspec/core/reporter.rb:64:in `report'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:108:in `run_specs'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:86:in `run'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:70:in `run'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:38:in `invoke'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.2.3/exe/rspec:4:in `<top (required)>'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/bin/rspec:23:in `load'
    from /Users/jankeesvw/.rbenv/versions/2.1.1/bin/rspec:23:in `<main>'

@greysteil
Copy link

What's the status on this? We've been using @grk's fork for the last few months but would love to see this merged and be able to move back to using master.

@bellkev
Copy link
Contributor

bellkev commented Jun 24, 2015

This fork is obsolete now, and we recommend users use the standard rspec_junit_formatter. Is this problem still present in the upstream rspec_junit_formatter project?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants