From: Jan Provaznik <jprovazn(a)redhat.com>
Also removed older test "launch instances if user has no access to hardware
profile" which
doesn't seem to do what it describes anyway.
---
src/spec/models/deployment_spec.rb | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/spec/models/deployment_spec.rb b/src/spec/models/deployment_spec.rb
index b390ca7..20497db 100644
--- a/src/spec/models/deployment_spec.rb
+++ b/src/spec/models/deployment_spec.rb
@@ -255,15 +255,24 @@ describe Deployment do
@deployment.instances[1].provider_account.should == @provider_account2
end
- it "should not launch instances if user has no access to hardware profile"
do
+ it "should set create_failed status for instances if match not found" do
@deployment.save!
@deployment.instances.should be_empty
-
+ @deployment.pool.pool_family.provider_accounts.destroy_all
Taskomatic.stub!(:create_instance).and_return(true)
- @deployment.launch(@user_for_launch)[:errors].should be_empty
- @deployment.instances.count.should == 2
+ @deployment.launch(@user_for_launch)
+ @deployment.instances.should_not be_empty
+ @deployment.instances.each {|i| i.state.should == Instance::STATE_CREATE_FAILED}
end
+ it "should set create_failed status for instances if instance's launch
raises an exception" do
+ @deployment.save!
+ @deployment.instances.should be_empty
+ Taskomatic.stub!(:create_instance).and_raise("an exception")
+ @deployment.launch(@user_for_launch)
+ @deployment.instances.should_not be_empty
+ @deployment.instances.each {|i| i.state.should == Instance::STATE_CREATE_FAILED}
+ end
end
describe ".stop_instances_and_destroy!" do
--
1.7.7.6