Commit a0ab45d0 authored by Robert Speicher's avatar Robert Speicher

Fix the `Gitlab::Seeder` monkey patch to disable mail delivery

parent 12592ac7
require './spec/support/sidekiq'
Gitlab::Seeder.quiet do
Issue.all.each do |issue|
Issue.find_each do |issue|
project = issue.project
project.team.users.each do |user|
......@@ -16,7 +16,7 @@ Gitlab::Seeder.quiet do
end
end
MergeRequest.all.each do |mr|
MergeRequest.find_each do |mr|
project = mr.project
project.team.users.each do |user|
......
module DeliverNever
def deliver_later
self
end
end
module Gitlab
class Seeder
def self.quiet
mute_mailer
SeedFu.quiet = true
yield
SeedFu.quiet = false
puts "\nOK".color(:green)
end
def self.by_user(user)
yield
end
def self.mute_mailer
code = <<-eos
def Notify.deliver_later
self
end
eos
eval(code) # rubocop:disable Security/Eval
ActionMailer::MessageDelivery.prepend(DeliverNever)
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment