Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly support kwargs in shared example groups #2711

Closed
wants to merge 1 commit into from
Closed

Explicitly support kwargs in shared example groups #2711

wants to merge 1 commit into from

Conversation

kddnewton
Copy link

Since the introduction of Ruby 2.7, positional and keyword argument separation is required, otherwise it warns:
https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/

This patch allows RSpec to use kwargs explicitly with shared context, as in:

RSpec.shared_examples "shared context" do |foo:|

Since the introduction of Ruby 2.7, positional and keyword argument separation is required, otherwise it warns:
https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/

This patch allows RSpec to use kwargs explicitly with shared context, as in:

```ruby
RSpec.shared_examples "shared context" do |foo:|
```
@kddnewton
Copy link
Author

Oh wow I didn't realize the support matrix went back that far. I'll take another pass at this.

@pirj
Copy link
Member

pirj commented Apr 2, 2020

I suppose it won't be possible to get rid of those warnings and support older Rubies at the same time without eval or conditional file requires. Please feel free to get as far as you can, this will definitely find its way into RSpec 4.0.

@kddnewton
Copy link
Author

Yeah, I've seen the eval approach around the ecosystem and in Ruby core. I'll copy one of those in here.

@JonRowe
Copy link
Member

JonRowe commented Apr 4, 2020

Hi @kddeisz I've closed this for now in favour of #2716, however, I'd prefer your version when we work on RSpec 4 that drops support for older Rubies.

@kddnewton
Copy link
Author

No worries! Let me know when you’re ready to do that I’d love to contribute

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

Successfully merging this pull request may close these issues.

3 participants