mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 07:14:41 +08:00
DEV: Avoid $
globals (#15453)
Also: * Remove an unused method (#fill_email) * Replace a method that was used just once (#generate_username) with `SecureRandom.alphanumeric` * Remove an obsolete dev puma `tmp/restart` file logic
This commit is contained in:
@ -58,11 +58,6 @@ module Helpers
|
||||
post
|
||||
end
|
||||
|
||||
def generate_username(length = 10)
|
||||
range = [*'a'..'z']
|
||||
Array.new(length) { range.sample }.join
|
||||
end
|
||||
|
||||
def stub_guardian(user)
|
||||
guardian = Guardian.new(user)
|
||||
yield(guardian) if block_given?
|
||||
@ -82,14 +77,6 @@ module Helpers
|
||||
expect(result).to eq(true)
|
||||
end
|
||||
|
||||
def fill_email(mail, from, to, body = nil, subject = nil, cc = nil)
|
||||
result = mail.gsub("FROM", from).gsub("TO", to)
|
||||
result.gsub!(/Hey.*/m, body) if body
|
||||
result.sub!(/We .*/, subject) if subject
|
||||
result.sub!("CC", cc.presence || "")
|
||||
result
|
||||
end
|
||||
|
||||
def email(email_name)
|
||||
fixture_file("emails/#{email_name}.eml")
|
||||
end
|
||||
|
Reference in New Issue
Block a user