Commit fa1fa3a44af8bcfefa19d3c6b92c13774a27bba7
1 parent
4ab0eafe
Exists in
colab
and in
4 other branches
Changed metric result range to exclude ends
And added a test case for it. Signed-off-by: Daniel Miranda <danielkza2@gmail.com>
Showing
2 changed files
with
11 additions
and
1 deletions
Show diff stats
app/helpers/processings_helper.rb
| ... | ... | @@ -13,7 +13,8 @@ module ProcessingsHelper |
| 13 | 13 | range_snapshots.each do |range_snapshot| |
| 14 | 14 | range = Range.new( |
| 15 | 15 | range_snapshot.beginning == '-INF' ? -Float::INFINITY : range_snapshot.beginning.to_f, |
| 16 | - range_snapshot.end == 'INF' ? Float::INFINITY : range_snapshot.end.to_f | |
| 16 | + range_snapshot.end == 'INF' ? Float::INFINITY : range_snapshot.end.to_f, | |
| 17 | + exclude_end: true | |
| 17 | 18 | ) |
| 18 | 19 | return range_snapshot if range === metric_result.value |
| 19 | 20 | end | ... | ... |
spec/helpers/processings_helper_spec.rb
| ... | ... | @@ -49,6 +49,15 @@ describe ProcessingsHelper, :type => :helper do |
| 49 | 49 | expect(helper.find_range_snapshot(metric_result)).to eq(range_snapshots[0]) |
| 50 | 50 | end |
| 51 | 51 | end |
| 52 | + | |
| 53 | + context 'with incomplete ranges' do | |
| 54 | + let!(:range_snapshots) { [make_range('-INF', 6.0), make_range(6.1, 'INF')] } | |
| 55 | + | |
| 56 | + it 'should return nil' do | |
| 57 | + expect(helper.find_range_snapshot(metric_result)).to be_nil | |
| 58 | + end | |
| 59 | + end | |
| 60 | + | |
| 52 | 61 | end |
| 53 | 62 | |
| 54 | 63 | describe 'format_module_name' do | ... | ... |