Skip to content

Commit

Permalink
Unit test for ConsumptionWithoutRollups
Browse files Browse the repository at this point in the history
(cherry picked from commit f3a2d6e)
  • Loading branch information
isimluk committed Jan 10, 2017
1 parent 57e4f1c commit 44aa15b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions spec/models/chargeback/consumption_without_rollups_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
describe Chargeback::ConsumptionWithoutRollups do
let(:cores) { 7 }
let(:mem_mb) { 1777 }
let(:disk_size) { 12_345 }
let(:hardware) do
FactoryGirl.build(:hardware,
:cpu_total_cores => cores,
:memory_mb => mem_mb,
:disks => [FactoryGirl.build(:disk, :size => disk_size)])
end
let(:vm) { FactoryGirl.build(:vm_microsoft, :hardware => hardware) }
let(:consumption) { described_class.new(vm, nil, nil) }

describe '#avg' do
it 'returns current values' do
expect(consumption.avg('derived_vm_numvcpus')).to eq(cores)
expect(consumption.avg('derived_memory_available')).to eq(mem_mb)
expect(consumption.avg('derived_vm_allocated_disk_storage')).to eq(disk_size)
end
end
end

0 comments on commit 44aa15b

Please sign in to comment.