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

Commit a53c46f

Browse files
committed
Skip unnecessary :context|:all hooks
This makes that previous test pass, and the test suite is still green, so I'm _assuming_ that this works and doesn't break other stuff! However, I'd be happy to make any alterations if this doesn't look like it's the right way of tackling this problem.
1 parent 8bf66f5 commit a53c46f

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,3 +382,4 @@ Finished in 0.000379 seconds
382382
* [https://github.com/rspec/rspec-expectations](https://github.com/rspec/rspec-expectations)
383383
* [https://github.com/rspec/rspec-mocks](https://github.com/rspec/rspec-mocks)
384384
* [https://github.com/rspec/rspec-rails](https://github.com/rspec/rspec-rails)
385+

lib/rspec/core/hooks.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,8 @@ def all_hooks_for(position, scope)
503503
end
504504

505505
def run_owned_hooks_for(position, scope, example_or_group)
506+
return if example_or_group.class.respond_to?(:metadata) &&
507+
example_or_group.class.metadata.keys.include?(:skip)
506508
matching_hooks_for(position, scope, example_or_group).each do |hook|
507509
hook.run(example_or_group)
508510
end

0 commit comments

Comments
 (0)