mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 01:58:41 -05:00
Add spec tests for #get_tag_metrics method
This commit is contained in:
parent
726de893ec
commit
c255494ddd
1 changed files with 17 additions and 1 deletions
|
|
@ -152,4 +152,20 @@ describe Vmpooler::API::Helpers do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#get_tag_metrics' do
|
||||
let(:redis) { double('redis') }
|
||||
|
||||
it 'returns basic tag metrics' do
|
||||
allow(redis).to receive(:hgetall).with('vmpooler__tag__2015-01-01').and_return({"abcdefghijklmno:tag" => "value"})
|
||||
|
||||
expect(subject.get_tag_metrics(redis, '2015-01-01')).to eq({"tag" => {"value"=>1, "total"=>1}})
|
||||
end
|
||||
|
||||
it 'calculates tag totals' do
|
||||
allow(redis).to receive(:hgetall).with('vmpooler__tag__2015-01-01').and_return({"abcdefghijklmno:tag" => "value", "pqrstuvwxyz12345:tag" => "another_value"})
|
||||
|
||||
expect(subject.get_tag_metrics(redis, '2015-01-01')).to eq({"tag"=>{"value"=>1, "total"=>2, "another_value"=>1}})
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue