Skip to content

Commit

Permalink
Refactor for RSpec/BeforeAfterAll
Browse files Browse the repository at this point in the history
- Use `Set[...]` instead of  %i[...]
- Use RESTRICT_ON_SEND in def_node_matcher
  • Loading branch information
ydah committed Nov 14, 2023
1 parent 8dd01d1 commit 2bddaed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/rubocop/cop/rspec/before_after_all.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ class BeforeAfterAll < Base
'`use_transactional_fixtures` is enabled, then records created ' \
'in `%<hook>s` are not automatically rolled back.'

RESTRICT_ON_SEND = %i[before after].freeze
RESTRICT_ON_SEND = Set[:before, :after].freeze

# @!method before_or_after_all(node)
def_node_matcher :before_or_after_all, <<-PATTERN
$(send _ {:before :after} (sym {:all :context}))
$(send _ RESTRICT_ON_SEND (sym {:all :context}))
PATTERN

def on_send(node)
Expand Down

0 comments on commit 2bddaed

Please sign in to comment.