File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -114,7 +114,7 @@ def digit
114114 # @faker.version 1.0.0
115115 def hexadecimal ( digits : 6 )
116116 hex = ''
117- digits . times { hex += rand ( 15 ) . to_s ( 16 ) }
117+ digits . times { hex += rand ( 16 ) . to_s ( 16 ) }
118118 hex
119119 end
120120
Original file line number Diff line number Diff line change @@ -130,6 +130,13 @@ def test_hexadecimal
130130 assert_match ( /[0-9a-f]{7}/ , @tester . hexadecimal ( digits : 7 ) )
131131 end
132132
133+ def test_hexadecimal_range
134+ random_hex = @tester . hexadecimal ( digits : 1000 )
135+ expected_range = Array ( '0' ..'9' ) + Array ( 'a' ..'f' )
136+
137+ expected_range . each { |char | assert_include ( random_hex , char ) }
138+ end
139+
133140 def test_binary
134141 assert_match ( /^[0-1]{4}$/ , @tester . binary ( digits : 4 ) )
135142 assert_match ( /^[0-1]{8}$/ , @tester . binary ( digits : 8 ) )
You can’t perform that action at this time.
0 commit comments