spec/container_spec.rb in testlab-0.6.5 vs spec/container_spec.rb in testlab-0.6.6

- old
+ new

@@ -154,18 +154,21 @@ end end describe "#destroy" do it "should destroy the container" do + subject.lxc.stub(:exists?) { true } + subject.lxc.stub(:state) { :stopped } subject.lxc.stub(:destroy) { true } subject.lxc_clone.stub(:destroy) { true } subject.destroy end end describe "#up" do it "should up the container" do + subject.lxc.stub(:exists?) { true } subject.lxc.stub(:start) { true } subject.lxc.stub(:wait) { true } subject.lxc.stub(:state) { :running } subject.lxc.stub(:attach) @@ -175,55 +178,58 @@ end end describe "#down" do it "should down the container" do + subject.lxc.stub(:exists?) { true } subject.lxc.stub(:stop) { true } subject.lxc.stub(:wait) { true } subject.lxc.stub(:state) { :stopped } subject.down end end describe "#setup" do context "with no provisioner" do - it "should create and online the container" do - subject.stub(:create) { true } - subject.stub(:up) { true } + it "should setup the container" do + subject.lxc.stub(:exists?) { true } + subject.lxc.stub(:state) { :stopped } subject.provisioners = Array.new subject.setup end end context "with the shell provisioner" do - it "should create and online the container" do + it "should setup the container" do subject = TestLab::Container.first('server-shell') - subject.stub(:create) { true } - subject.stub(:up) { true } + + subject.lxc.stub(:exists?) { true } + subject.lxc.stub(:state) { :stopped } subject.provisioners = Array.new subject.setup end end end describe "#teardown" do context "with no provisioner" do - it "should create and online the container" do - subject.stub(:down) { true } - subject.stub(:destroy) { true } + it "should teardown the container" do + subject.lxc.stub(:exists?) { true } + subject.lxc.stub(:state) { :stopped } subject.provisioners = Array.new subject.teardown end end context "with the shell provisioner" do - it "should create and online the container" do + it "should teardown the container" do subject = TestLab::Container.first('server-shell') - subject.stub(:down) { true } - subject.stub(:destroy) { true } + + subject.lxc.stub(:exists?) { true } + subject.lxc.stub(:state) { :stopped } subject.provisioners = Array.new subject.teardown end end