Skip to content

Commit

Permalink
Simplify Spec.around_each(&) call
Browse files Browse the repository at this point in the history
  • Loading branch information
akadusei committed Aug 13, 2024
1 parent e1739e9 commit 4e63c22
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions spec/setup/worker.cr
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ end
Spec.around_each do |spec|
next spec.run if all_tags(spec.example).includes?("skip_around_each")

if find_parent(spec.example, "no store")
Mel.settings.store = nil
Mel.stop
next spec.run
end

{Mel::Memory.new, Mel::Redis.new(ENV["REDIS_URL"])}.each do |store|
Mel.settings.store = store
tasks.call
Expand All @@ -28,12 +22,6 @@ end

Spec.after_suite(&tasks)

private def find_parent(example, description)
return unless example.is_a?(Spec::Item)
return example if example.description == description
find_parent(example.parent, description)
end

private def all_tags(example)
return Set(String).new unless example.is_a?(Spec::Item)
result = example.tags.try(&.dup) || Set(String).new
Expand Down

0 comments on commit 4e63c22

Please sign in to comment.