Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Implement RSpec.current_scope (in 4.0, to switch rspec-rails to it painlessly) #2910

Closed
wants to merge 1 commit into from

Conversation

pirj
Copy link
Member

@pirj pirj commented Jul 26, 2021

This is a reproduction of #2895 on 4-0-dev branch.

The plan:

  1. Add the method to rspec-core 4.0.0.pre (this PR)
  2. Update rspec-rails's main branch to use RSpec.current_scope (main depends on 4.0.0.pre of rspec-*), Use RSpec.current_scope rspec-rails#2511
  3. Merge Add RSpec.current_scope method to replace currently_executing_a_context_hook? and self.inspect hack #2895 (deprecates currently_executing_a_context_hook? and introduces RSpec.current_scope) to rspec-core 3.10-maintenance (will become part of 3.11/3.99)
  4. Send a PR to remove currently_executing_a_context_hook? from 4-0-dev

My reasoning is:

rspec-rails needs to do the following condition:
`if RSpec.current_scope == :before_context_hook`

test_prof needs to do the following condition:
`if RSpec.current_scope == :before_context_hook`

amd my little helper needs the following
`unless [:before_example_hook, :example].include?(RSpec.current_scope)`
@pirj pirj self-assigned this Jul 26, 2021
@pirj pirj changed the title Implement RSpec.current_scope Implement RSpec.current_scope (in 4.0, to switch rspec-rails to it painlessly) Jul 26, 2021
@pirj pirj requested review from JonRowe and benoittgt July 26, 2021 18:10
@pirj pirj added this to the 4.0 milestone Jul 26, 2021
@pirj pirj added the Feature label Jul 26, 2021
@JonRowe
Copy link
Member

JonRowe commented Aug 12, 2021

Is this PR needed? Normally we just cherry-pick the merge commits across?

@pirj
Copy link
Member Author

pirj commented Aug 12, 2021

Cherry-picking is an option, and surely a simpler one.
At least it served its goal to demonstrate that rspec/rspec-rails#2511 is green.

@pirj
Copy link
Member Author

pirj commented Aug 14, 2021

Cherry-picked #2895 to 4-0-dev.

@pirj pirj closed this Aug 14, 2021
@pirj pirj deleted the rspec-current_scope branch August 14, 2021 16:32
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants