push
github
0 of 18 new or added lines in 3 files covered. (0.0%)
1924 existing lines in 56 files now uncovered.0 of 2082 relevant lines covered (0.0%)
0.0 hits per line
UNCOV
1
|
require 'unleash/strategy/util'
|
× |
2 |
|
|
UNCOV
3
|
module Unleash |
× |
UNCOV
4
|
module Strategy |
× |
UNCOV
5
|
class GradualRolloutRandom < Base |
× |
UNCOV
6
|
def name |
× |
7 |
'gradualRolloutRandom'
|
× |
8 |
end
|
|
9 |
|
|
10 |
# need: params['percentage']
|
|
UNCOV
11
|
def is_enabled?(params = {}, _context = nil) |
× |
UNCOV
12
|
return false unless params.is_a?(Hash) && params.has_key?('percentage') |
× |
13 |
|
|
UNCOV
14
|
begin
|
× |
UNCOV
15
|
percentage = Integer(params['percentage'] || 0) |
× |
16 |
rescue ArgumentError |
|
UNCOV
17
|
return false |
× |
18 |
end
|
|
19 |
|
|
UNCOV
20
|
(percentage >= Random.rand(1..100)) |
× |
21 |
end
|
|
22 |
end
|
|
23 |
end
|
|
24 |
end
|