From: Jan Provaznik <[email protected]>

Added test for name and uuid uniqueness
---
 src/spec/models/template_spec.rb |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/spec/models/template_spec.rb b/src/spec/models/template_spec.rb
index ef30fc1..0ce30c8 100644
--- a/src/spec/models/template_spec.rb
+++ b/src/spec/models/template_spec.rb
@@ -16,4 +16,18 @@ describe Template do
     rimg.save
     tpl.providers.size.should eql(1)
   end
+
+  it "should require unique name" do
+    tpl1 = Factory.build(:template, :name => 'test')
+    tpl1.save
+    tpl2 = Factory.build(:template, :name => 'test')
+    tpl2.should_not be_valid
+  end
+
+  it "should require unique uuid" do
+    tpl1 = Factory.build(:template, :uuid => 'test')
+    tpl1.save
+    tpl2 = Factory.build(:template, :uuid => 'test')
+    tpl2.should_not be_valid
+  end
 end
-- 
1.7.2.3

_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to