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:
Jarek Radosz
2022-01-08 23:39:46 +01:00
committed by GitHub
parent c0d72ec3d6
commit 5a50f18c0c
14 changed files with 32 additions and 125 deletions

View File

@ -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