diff options
| author | Luc Donnet | 2017-12-05 16:10:35 +0100 |
|---|---|---|
| committer | GitHub | 2017-12-05 16:10:35 +0100 |
| commit | e66e96516094151f352b14b0dca6e6994e7eb4d0 (patch) | |
| tree | e3df1033b2def0e6beff45f637388c2a0d83c2b0 /spec/support/random.rb | |
| parent | 8848d279b4d3a27c1ddebe7636a49abe545ba73a (diff) | |
| parent | b50bcb8d6d0da921c002afb550a8aa4dffa3c2f0 (diff) | |
| download | chouette-core-e66e96516094151f352b14b0dca6e6994e7eb4d0.tar.bz2 | |
Merge pull request #139 from af83/5179-ref_creation_enforces_objectid_format
5179 ref creation enforces objectid format
Diffstat (limited to 'spec/support/random.rb')
| -rw-r--r-- | spec/support/random.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/support/random.rb b/spec/support/random.rb index 0ebc2ee5e..16d8b4df3 100644 --- a/spec/support/random.rb +++ b/spec/support/random.rb @@ -10,6 +10,15 @@ module Support def random_element from from[random_int(from.size)] end + + def random_elements( from, count: ) + (1..count).map{ |_| random_element from } + end + + def distinct_random_elements( from, count: ) + f = from.dup + (1..count).map { |_| f.delete_at( random_int(f.size) ) } + end def random_int max_plus_one=PRETTY_LARGE_INT (random_number * max_plus_one).to_i |
