Sha256: 3ff76d271a7b923844997a46986112e14162bf9c23e27f4fba6bf4293aea5e97

Contents?: true

Size: 566 Bytes

Versions: 9

Compression:

Stored size: 566 Bytes

Contents

def random_bool
  Kernel.rand(2) == 1
end

def random_int(min,max)
  count = max - min + 1
  Kernel.rand(count) + min
end

def random_decimal(min,max,precision=2)
  multiplier = 10 ** precision
  count = max - min + 1
  puts "multiplier: #{multiplier}"
  (Kernel.rand(count * multiplier) + min * multiplier).to_f / multiplier
end

def random_value(values)
  values[random_int(0,(values.length-1))]
end

def generate_plain_text_from_html(html)
  IO.popen('lynx -stdin --dump','w+') do |lynx|
    lynx.write html
    lynx.close_write
    lynx.readlines.join
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mail_manager-3.2.25.1 spec/test_app/spec/factories/_functions.rb
mail_manager-3.2.22.0 spec/test_app/spec/factories/_functions.rb
mail_manager-3.2.7 spec/test_app/spec/factories/_functions.rb
mail_manager-3.2.6 spec/test_app/spec/factories/_functions.rb
mail_manager-3.2.5 spec/test_app/spec/factories/_functions.rb
mail_manager-3.2.4 spec/test_app/spec/factories/_functions.rb
mail_manager-3.2.2 spec/test_app/spec/factories/_functions.rb
mail_manager-3.2.1 spec/test_app/spec/factories/_functions.rb
mail_manager-3.2.0 spec/test_app/spec/factories/_functions.rb