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

Commit ff70bc9

Browse files
committed
Add failing test for new feature
This adds a test that I think should represent the behavior we want. I did my best to keep the tests consistent with the other specs in that file.
1 parent c0f7d2c commit ff70bc9

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

spec/rspec/core/hooks_filtering_spec.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,23 @@ module RSpec::Core
319319
expect(filters).to eq([])
320320
end
321321

322+
it "does not run :all|:context hooks if the entire context is skipped" do
323+
filters = []
324+
RSpec.configure do |c|
325+
c.before(:all) { filters << "before all in config"}
326+
c.after(:all) { filters << "after all in config"}
327+
c.before(:context) { filters << "before context in config"}
328+
c.after(:context) { filters << "after context in config"}
329+
end
330+
group = RSpec.xdescribe("skipped describe") do
331+
xcontext("skipped context") do
332+
it("is skipped") {}
333+
end
334+
end
335+
group.run
336+
expect(filters).to eq([])
337+
end
338+
322339
context "when the hook filters apply to individual examples instead of example groups" do
323340
let(:each_filters) { [] }
324341
let(:all_filters) { [] }

0 commit comments

Comments
 (0)