(maint) finish converting dashboard specs

This commit is contained in:
Rick Bradley 2016-06-02 12:16:04 -05:00
parent 9af40db8b3
commit bd31d56fff

View file

@ -116,54 +116,58 @@ describe Vmpooler::API do
end end
end end
# describe '/dashboard/stats/vmpooler/running' do describe '/dashboard/stats/vmpooler/running' do
# let(:config) { { let(:config) { {
# pools: [ pools: [
# {'name' => 'pool-1', 'size' => 5}, {'name' => 'pool-1', 'size' => 5},
# {'name' => 'pool-2', 'size' => 1}, {'name' => 'pool-2', 'size' => 1},
# {'name' => 'diffpool-1', 'size' => 3} {'name' => 'diffpool-1', 'size' => 3}
# ], ],
# graphite: {} graphite: {}
# } } } }
# let(:redis) { double('redis') }
# before do
# before do $config = config
# $config = config app.settings.set :config, config
# app.settings.set :config, config app.settings.set :redis, redis
# app.settings.set :redis, redis app.settings.set :environment, :test
# app.settings.set :environment, :test end
# end
# context 'without history param' do
# context 'without history param' do
# it 'returns basic JSON' do
# it 'returns basic JSON' do get '/dashboard/stats/vmpooler/running'
# allow(redis).to receive(:scard)
# json_hash = {pool: {running: 0}, diffpool: {running: 0}}
# expect(redis).to receive(:scard).exactly(3).times
# expect(last_response).to be_ok
# get '/dashboard/stats/vmpooler/running' expect(last_response.body).to eq(JSON.pretty_generate(json_hash))
# expect(last_response.header['Content-Type']).to eq('application/json')
# json_hash = {pool: {running: 0}, diffpool: {running: 0}} end
#
# expect(last_response).to be_ok it 'adds major correctly' do
# expect(last_response.body).to eq(JSON.pretty_generate(json_hash)) create_running_vm('pool-1', 'vm1')
# expect(last_response.header['Content-Type']).to eq('application/json') create_running_vm('pool-1', 'vm2')
# end create_running_vm('pool-1', 'vm3')
#
# it 'adds major correctly' do create_running_vm('pool-2', 'vm4')
# allow(redis).to receive(:scard).with('vmpooler__running__pool-1').and_return(3) create_running_vm('pool-2', 'vm5')
# allow(redis).to receive(:scard).with('vmpooler__running__pool-2').and_return(5) create_running_vm('pool-2', 'vm6')
# allow(redis).to receive(:scard).with('vmpooler__running__diffpool-1').and_return(2) create_running_vm('pool-2', 'vm7')
# create_running_vm('pool-2', 'vm8')
# get '/dashboard/stats/vmpooler/running'
# create_running_vm('diffpool-1', 'vm9')
# json_hash = {pool: {running: 8}, diffpool: {running: 2}} create_running_vm('diffpool-1', 'vm10')
#
# expect(last_response).to be_ok get '/dashboard/stats/vmpooler/running'
# expect(last_response.body).to eq(JSON.pretty_generate(json_hash))
# expect(last_response.header['Content-Type']).to eq('application/json') json_hash = {pool: {running: 8}, diffpool: {running: 2}}
# end
# end expect(last_response).to be_ok
# end expect(last_response.body).to eq(JSON.pretty_generate(json_hash))
expect(last_response.header['Content-Type']).to eq('application/json')
end
end
end
end end
end end