Fill multiplier field, confirm Add button disabled

This commit is contained in:
2024-12-12 00:44:26 +01:00
parent 3a25c1dbd0
commit d5719b1e9d
5 changed files with 39 additions and 7 deletions

View File

@@ -32,6 +32,18 @@ class ActiveSupport::TestCase
"%s@%s.%s" % (1..3).map { SecureRandom.alphanumeric(rand(1..20)) }
end
# Assumes: max >= step and step = 1e[-]N, both as strings
def random_number(max, step)
max.delete!('.')
precision = max.length
start = rand(precision) + 1
d = (rand(max.to_i) + 1) % 10**start
length = rand([0, 1..4, 4..precision].sample)
d = d.truncate(-start + length)
d = 10**(start - length) if d.zero?
BigDecimal(step) * d
end
def with_last_email
yield(ActionMailer::Base.deliveries.last)
end