1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
require 'spec_helper'
SingleCov.covered! uncovered: 1
# Volume requests are actually slow enough to occasionally not work
# Use sleep statements to manage that
describe Docker::Volume, :docker_1_9 do
let(:name) { "ArbitraryNameForTheRakeTestVolume" }
describe '.create' do
let(:volume) { Docker::Volume.create(name) }
after { volume.remove }
it 'creates a volume' do
expect(volume.id).to eq(name)
end
end
describe '.get' do
let(:volume) { Docker::Volume.get(name) }
before { Docker::Volume.create(name); sleep 1 }
after { volume.remove }
it 'gets volume details' do
expect(volume.id).to eq(name)
expect(volume.info).to_not be_empty
end
end
describe '.all' do
after { Docker::Volume.get(name).remove }
it 'gets a list of volumes' do
expect { Docker::Volume.create(name); sleep 1 }.to change { Docker::Volume.all.length }.by(1)
end
end
describe '.prune', :docker_17_03 => true do
it 'prune volumes' do
expect { Docker::Volume.prune }.not_to raise_error
end
end
describe '#remove' do
it 'removes a volume' do
volume = Docker::Volume.create(name)
sleep 1
expect { volume.remove }.to change { Docker::Volume.all.length }.by(-1)
end
end
end
|