Fix the Gitlab::Seeder
monkey patch to disable mail delivery
This commit is contained in:
parent
12592ac7f4
commit
a0ab45d0c3
2 changed files with 11 additions and 12 deletions
|
@ -1,7 +1,7 @@
|
|||
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|
|
||||
|
|
|
@ -1,24 +1,23 @@
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue