[PATCH conductor 2/2] Added rspec test for reaching of user's quota

jzigmund at redhat.com jzigmund at redhat.com
Tue Mar 6 13:43:43 UTC 2012


From: Jozef Zigmund <jzigmund at redhat.com>

---
 src/spec/models/deployment_spec.rb |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/spec/models/deployment_spec.rb b/src/spec/models/deployment_spec.rb
index 0feecfc..19e3a54 100644
--- a/src/spec/models/deployment_spec.rb
+++ b/src/spec/models/deployment_spec.rb
@@ -184,6 +184,21 @@ describe Deployment do
     end
   end
 
+  describe ".check_assemblies_matches" do
+    before do
+      admin_perms = FactoryGirl.create :admin_permission
+      @user_for_launch = admin_perms.user
+      @user_for_launch.quota.maximum_running_instances = 1
+      Instance.any_instance.stub(:matches).and_return(["test","test"])
+      Deployment.any_instance.stub(:common_provider_accounts_for).and_return(["test","test"])
+    end
+
+    it "return error when user quota was reached" do
+      errors = @deployment.check_assemblies_matches(@user_for_launch)
+      errors.should have(2).items
+      errors.last.should include I18n.t('instances.errors.user_quota_reached')
+    end
+  end
 
   describe "using image from iwhd" do
     before do
-- 
1.7.7.6




More information about the aeolus-devel mailing list