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

Commit 5e7f115

Browse files
committed
Remove deprecated currently_executing_a_context_hook?
1 parent d8d985d commit 5e7f115

File tree

3 files changed

+1
-66
lines changed

3 files changed

+1
-66
lines changed

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Breaking Changes:
3333
(Phil Pirozhkov, #2864)
3434
* Unify multi-condition filtering to use "all" semantic. (Phil Pirozhkov, #2874)
3535
* Remove support for RR test double framework version < 3.0. (Phil Pirozhkov, #2884)
36+
* Remove deprecated `currently_executing_a_context_hook?`. (Phil Pirozhkov, #????)
3637

3738
Enhancements:
3839

lib/rspec/core/example_group.rb

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -438,8 +438,6 @@ def self.set_it_up(description, args, registration_collection, &example_group_bl
438438

439439
ExampleGroups.assign_const(self)
440440

441-
@currently_executing_a_context_hook = false
442-
443441
config.configure_group(self)
444442
end
445443

@@ -534,30 +532,15 @@ def self.store_before_context_ivars(example_group_instance)
534532
end
535533
end
536534

537-
# @deprecated use `RSpec.current_scope` instead
538-
# Returns true if a `before(:context)` or `after(:context)`
539-
# hook is currently executing.
540-
def self.currently_executing_a_context_hook?
541-
RSpec.deprecate(
542-
"currently_executing_a_context_hook",
543-
:replacement => "RSpec.current_scope"
544-
)
545-
546-
@currently_executing_a_context_hook
547-
end
548-
549535
# @private
550536
def self.run_before_context_hooks(example_group_instance)
551537
set_ivars(example_group_instance, superclass_before_context_ivars)
552538

553-
@currently_executing_a_context_hook = true
554-
555539
ContextHookMemoized::Before.isolate_for_context_hook(example_group_instance) do
556540
hooks.run(:before, :context, example_group_instance)
557541
end
558542
ensure
559543
store_before_context_ivars(example_group_instance)
560-
@currently_executing_a_context_hook = false
561544
end
562545

563546
# @private
@@ -569,14 +552,11 @@ def self.superclass_before_context_ivars
569552
def self.run_after_context_hooks(example_group_instance)
570553
set_ivars(example_group_instance, before_context_ivars)
571554

572-
@currently_executing_a_context_hook = true
573-
574555
ContextHookMemoized::After.isolate_for_context_hook(example_group_instance) do
575556
hooks.run(:after, :context, example_group_instance)
576557
end
577558
ensure
578559
before_context_ivars.clear
579-
@currently_executing_a_context_hook = false
580560
end
581561

582562
# Runs all the examples in this group.

spec/rspec/core/example_group_spec.rb

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -684,52 +684,6 @@ def define_and_run_group(define_outer_example = false)
684684
expect(order).to eq([:example, :after_example, :example, :after_example])
685685
end
686686

687-
describe "#currently_executing_a_context_hook?" do
688-
it "sets currently_executing_a_context_hook? to false initially" do
689-
group = RSpec.describe
690-
expect(group.currently_executing_a_context_hook?).to be false
691-
end
692-
693-
it "sets currently_executing_a_context_hook? during before(:context) execution" do
694-
group = RSpec.describe
695-
hook_result = nil
696-
group.before(:context) { hook_result = group.currently_executing_a_context_hook? }
697-
group.example("") {}
698-
group.run
699-
expect(hook_result).to be true
700-
end
701-
702-
it "does not set currently_executing_a_context_hook? outside of before(:context) execution" do
703-
group = RSpec.describe
704-
hook_result = nil
705-
706-
group.before(:context) { hook_result = group.currently_executing_a_context_hook? }
707-
group.before(:each) { hook_result = group.currently_executing_a_context_hook? }
708-
group.example("") {}
709-
group.run
710-
expect(hook_result).to be false
711-
end
712-
713-
it "sets currently_executing_a_context_hook? during after(:context) execution" do
714-
group = RSpec.describe
715-
hook_result = nil
716-
717-
group.after(:context) { hook_result = group.currently_executing_a_context_hook? }
718-
group.example("") {}
719-
group.run
720-
expect(hook_result).to be true
721-
end
722-
723-
it "unsets currently_executing_a_context_hook? after an after(:context) hook is done" do
724-
group = RSpec.describe
725-
group.after(:context) { }
726-
group.example("") {}
727-
group.run
728-
expect(group.currently_executing_a_context_hook?).to be false
729-
end
730-
end
731-
end
732-
733687
it "runs the before alls in order" do
734688
group = RSpec.describe
735689
order = []

0 commit comments

Comments
 (0)