mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-27 02:18:41 -05:00
(maint) repair incorrect test
The mockist version of the test allows redis' scard to return nil, which it does not actually do in real life. Verified the behavior in the code via a debugger. Fixed the test.
This commit is contained in:
parent
c30c7ac26b
commit
9af40db8b3
1 changed files with 3 additions and 7 deletions
|
|
@ -79,19 +79,15 @@ describe Vmpooler::API do
|
|||
expect(last_response.body).to eq(JSON.pretty_generate(json_hash))
|
||||
expect(last_response.header['Content-Type']).to eq('application/json')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'with history param' do
|
||||
it 'returns JSON with null history when redis does not has values' do
|
||||
allow(redis).to receive(:scard)
|
||||
expect(redis).to receive(:scard).exactly(4).times
|
||||
|
||||
it 'returns JSON with zeroed history when redis does not have values' do
|
||||
get '/dashboard/stats/vmpooler/pool', :history => true
|
||||
|
||||
json_hash = {
|
||||
pool1: {size: 5, ready: nil, history: [nil]},
|
||||
pool2: {size: 1, ready: nil, history: [nil]}
|
||||
pool1: {size: 5, ready: 0, history: [0]},
|
||||
pool2: {size: 1, ready: 0, history: [0]}
|
||||
}
|
||||
|
||||
expect(last_response).to be_ok
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue