summaryrefslogtreecommitdiff
path: root/spec/ruby/library/securerandom
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2019-09-29 16:03:58 +0200
committerBenoit Daloze <eregontp@gmail.com>2019-09-29 16:03:58 +0200
commit1c938a72aa9378f982dbc55327e86150c47b8707 (patch)
tree34a0bb0a45396c26eed111877a810c3aa793bff5 /spec/ruby/library/securerandom
parent31bb66a19df26409c9d47afcf37919c9a065516a (diff)
Update to ruby/spec@519df35
Diffstat (limited to 'spec/ruby/library/securerandom')
-rw-r--r--spec/ruby/library/securerandom/random_bytes_spec.rb4
-rw-r--r--spec/ruby/library/securerandom/random_number_spec.rb4
2 files changed, 8 insertions, 0 deletions
diff --git a/spec/ruby/library/securerandom/random_bytes_spec.rb b/spec/ruby/library/securerandom/random_bytes_spec.rb
index 275a897315..2794174f40 100644
--- a/spec/ruby/library/securerandom/random_bytes_spec.rb
+++ b/spec/ruby/library/securerandom/random_bytes_spec.rb
@@ -1,8 +1,12 @@
require_relative '../../spec_helper'
+require_relative '../../core/random/shared/bytes'
require 'securerandom'
describe "SecureRandom.random_bytes" do
+ it_behaves_like :random_bytes, :random_bytes, SecureRandom
+ it_behaves_like :random_bytes, :bytes, SecureRandom
+
it "generates a random binary string of length 16 if no argument is provided" do
bytes = SecureRandom.random_bytes
bytes.should be_kind_of(String)
diff --git a/spec/ruby/library/securerandom/random_number_spec.rb b/spec/ruby/library/securerandom/random_number_spec.rb
index 3c86f55bf5..3e1812c6e8 100644
--- a/spec/ruby/library/securerandom/random_number_spec.rb
+++ b/spec/ruby/library/securerandom/random_number_spec.rb
@@ -1,8 +1,12 @@
require_relative '../../spec_helper'
+require_relative '../../core/random/shared/rand'
require 'securerandom'
describe "SecureRandom.random_number" do
+ it_behaves_like :random_number, :rand, SecureRandom
+ it_behaves_like :random_number, :random_number, SecureRandom
+
it "generates a random positive number smaller then the positive integer argument" do
(1..64).each do |idx|
num = SecureRandom.random_number(idx)