spec/unit/docker_client_spec.rb in vocker-0.3.0 vs spec/unit/docker_client_spec.rb in vocker-0.3.1

- old
+ new

@@ -56,15 +56,22 @@ expect(communicator).to have_received.sudo(with{|cmd| cmd =~ /-dns=127\.0\.0\.1/}) end context 'when the container already exists' do before do - stub(communicator).test(with{|cmd| cmd =~ /docker ps/}) { true } - subject.run containers + stub(communicator).test(with{|cmd| cmd =~ /docker ps -a -q/}) { true } end - it 'starts the container' do + it 'starts the container if it is stopped' do + stub(communicator).test(with{|cmd| cmd =~ /docker ps -q/}) { false } + subject.run containers expect(communicator).to have_received.sudo(with{|cmd| cmd =~ /docker start/}) + end + + it 'noops if container is already running' do + stub(communicator).test(with{|cmd| cmd =~ /docker ps -q/}) { true } + subject.run containers + expect(communicator).to_not have_received.sudo(with{|cmd| cmd =~ /docker start/}) end end context 'when the container does not exist' do before do