Skip to content

Commit

Permalink
Complain if SecureRandom ever stops using Random::Formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
laserlemon authored Apr 12, 2024
1 parent bce022d commit 07a97b4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion spec/secure_random_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
RSpec.describe SecureRandom do
# Random::Formatter is responsible for decorating SecureRandom with all of
# its public API methods, such as random_number, hex, uuid, etc.
Random::Formatter.public_instance_methods.sort.each do |method|
secure_random_methods = Random::Formatter.public_instance_methods

raise "No public instance methods found on Random::Formatter" if secure_random_methods.none?

secure_random_methods.sort.each do |method|
describe ".#{method}" do
it "is random and repeatable when enabled" do
InsecureRandom.enable!
Expand Down

0 comments on commit 07a97b4

Please sign in to comment.