[PATCH Conductor 7/7] Bug 788148: Moved catalog entry tests to deployables spec

Scott Seago sseago at redhat.com
Wed Feb 29 07:43:23 UTC 2012


https://bugzilla.redhat.com/show_bug.cgi?id=788148

These tests were already testing deployables, so I moved them to the right spec test file while fixing them.
---
 src/spec/models/catalog_entry_spec.rb |   46 ---------------------------------
 src/spec/models/deployable_spec.rb    |   28 ++++++++++++++++++++
 2 files changed, 28 insertions(+), 46 deletions(-)
 delete mode 100644 src/spec/models/catalog_entry_spec.rb

diff --git a/src/spec/models/catalog_entry_spec.rb b/src/spec/models/catalog_entry_spec.rb
deleted file mode 100644
index fa9bea8..0000000
--- a/src/spec/models/catalog_entry_spec.rb
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-#   Copyright 2011 Red Hat, Inc.
-#
-#   Licensed under the Apache License, Version 2.0 (the "License");
-#   you may not use this file except in compliance with the License.
-#   You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-#   Unless required by applicable law or agreed to in writing, software
-#   distributed under the License is distributed on an "AS IS" BASIS,
-#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#   See the License for the specific language governing permissions and
-#   limitations under the License.
-#
-
-require 'spec_helper'
-
-describe CatalogEntry do
-  it "should have a name of reasonable length" do
-    catalog_entry = FactoryGirl.create :catalog_entry
-    [nil, '', 'x'*1025].each do |invalid_name|
-      catalog_entry.deployable.name = invalid_name
-      catalog_entry.deployable.should_not be_valid
-    end
-    catalog_entry.deployable.name = 'x'*1024
-    catalog_entry.deployable.should be_valid
-  end
-
-  it "should have unique name" do
-    catalog = FactoryGirl.create :catalog
-    catalog_entry = FactoryGirl.create :catalog_entry, :catalog => catalog
-    deployable2 = Factory.build(:deployable, :name => catalog_entry.deployable.name)
-    catalog_entry2 = Factory.build(:catalog_entry, :deployable => deployable2, :catalog => catalog)
-    catalog_entry2.deployable.should_not be_valid
-
-    catalog_entry2.deployable.name = 'unique name'
-    catalog_entry2.deployable.should be_valid
-  end
-
-  it "should have xml content" do
-    catalog_entry = FactoryGirl.create :catalog_entry
-    catalog_entry.deployable.xml = ''
-    catalog_entry.deployable.should_not be_valid
-  end
-end
diff --git a/src/spec/models/deployable_spec.rb b/src/spec/models/deployable_spec.rb
index d1d5734..6b32968 100644
--- a/src/spec/models/deployable_spec.rb
+++ b/src/spec/models/deployable_spec.rb
@@ -43,4 +43,32 @@ describe Deployable do
     deployable.valid_deployable_xml?
     deployable.errors[:xml].should == [I18n.t('catalog_entries.flash.warning.not_valid_duplicate_assembly_names')]
   end
+
+  it "should have a name of reasonable length" do
+    catalog = FactoryGirl.create :catalog
+    deployable = FactoryGirl.create(:deployable, :catalogs => [catalog])
+    [nil, '', 'x'*1025].each do |invalid_name|
+      deployable.name = invalid_name
+      deployable.should_not be_valid
+    end
+    deployable.name = 'x'*1024
+    deployable.should be_valid
+  end
+
+  it "should have unique name" do
+    catalog = FactoryGirl.create :catalog
+    deployable = FactoryGirl.create :deployable, :catalogs => [catalog]
+    deployable2 = Factory.build(:deployable, :name => deployable.name)
+    deployable2.should_not be_valid
+
+    deployable2.name = 'unique name'
+    deployable2.should be_valid
+  end
+
+  it "should have xml content" do
+    catalog = FactoryGirl.create :catalog
+    deployable = FactoryGirl.create :deployable, :catalogs => [catalog]
+    deployable.xml = ''
+    deployable.should_not be_valid
+  end
 end
-- 
1.7.6.4




More information about the aeolus-devel mailing list