aboutsummaryrefslogtreecommitdiffstats
path: root/spec/support/random.rb
blob: f0168b9ef8c91840cb51571f2412d9a0f3f9aa6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
module Support
  module Random

    PRETTY_LARGE_INT = 1 << 30 

    def random_hex
      SecureRandom.hex
    end

    def random_int
      (random_number * PRETTY_LARGE_INT).to_i
    end

    def random_number
      SecureRandom.random_number
    end

    def random_string
      SecureRandom.urlsafe_base64
    end
  end
end

RSpec.configure do | c |
  c.include Support::Random
end