aboutsummaryrefslogtreecommitdiffstats
path: root/spec/support/random.rb
diff options
context:
space:
mode:
authorRobert2017-12-05 11:37:25 +0100
committerRobert2017-12-05 12:19:42 +0100
commit642d2bd3a46a4b459acf18748dbfebf0cb6ca7df (patch)
tree773a01b7a4dc86a5dabfab98f6f44bdc9f949a50 /spec/support/random.rb
parent089c6935ca0e036de484834381e5beda7545d499 (diff)
downloadchouette-core-642d2bd3a46a4b459acf18748dbfebf0cb6ca7df.tar.bz2
Refs: #5179@1.25h; Referential Creation Enforces objectid_format from associated Workbench
- changed ObjectIdFormatterSupport as requested - respeced all defined cases - implemented respec Missing: What to do in `define_default_attributes` if ref has no workbench and no `objectid_format`?
Diffstat (limited to 'spec/support/random.rb')
-rw-r--r--spec/support/random.rb9
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