diff options
| author | Robert | 2017-09-29 17:55:58 +0200 | 
|---|---|---|
| committer | Robert | 2017-10-02 10:52:07 +0200 | 
| commit | f034dc2999a56295178c64921e6f059adc1a7bd9 (patch) | |
| tree | d9cf98cd0df42e7f776a727e09fefb02499a6d59 /spec/support/random.rb | |
| parent | ea6537e2f520ca9abba0ca63c68ee42afe08d872 (diff) | |
| download | chouette-core-f034dc2999a56295178c64921e6f059adc1a7bd9.tar.bz2 | |
Refs: #4627@0.75h;
Got some data_modifier support for attribute generation w/w-o defaults for model tests generic_attribute_control
Diffstat (limited to 'spec/support/random.rb')
| -rw-r--r-- | spec/support/random.rb | 26 | 
1 files changed, 26 insertions, 0 deletions
| diff --git a/spec/support/random.rb b/spec/support/random.rb new file mode 100644 index 000000000..f0168b9ef --- /dev/null +++ b/spec/support/random.rb @@ -0,0 +1,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 | 
