summaryrefslogtreecommitdiff
path: root/spec/unit/version
diff options
context:
space:
mode:
authorXabier de Zuazo <xabier@onddo.com>2013-03-13 12:03:35 +0100
committerBryan McLellan <btm@opscode.com>2013-04-11 13:04:33 -0700
commit7052e7712a6b159626c2077f86e8be551e79bbd4 (patch)
treeef0cb7faba3afcce049d2f8a34076344811625c6 /spec/unit/version
parentf554a1c0fbc1f308462d3d62544a0fd7ed7df6ec (diff)
downloadchef-7052e7712a6b159626c2077f86e8be551e79bbd4.tar.gz
[CHEF-3919] Removed Chef::Version::Cookbook code and replaced by a Chef::Version::Platform class, reverting Chef::Version class changes
Diffstat (limited to 'spec/unit/version')
-rw-r--r--spec/unit/version/platform_spec.rb (renamed from spec/unit/version/cookbook_spec.rb)30
1 files changed, 21 insertions, 9 deletions
diff --git a/spec/unit/version/cookbook_spec.rb b/spec/unit/version/platform_spec.rb
index 4bbb9eedb3..6245800f9d 100644
--- a/spec/unit/version/cookbook_spec.rb
+++ b/spec/unit/version/platform_spec.rb
@@ -15,35 +15,47 @@
# limitations under the License.
require 'spec_helper'
-require 'chef/version/cookbook'
+require 'chef/version/platform'
-describe Chef::Version::Cookbook do
+describe Chef::Version::Platform do
it "is a subclass of Chef::Version" do
- v = Chef::Version::Cookbook.new('1.1')
- v.should be_an_instance_of(Chef::Version::Cookbook)
+ v = Chef::Version::Platform.new('1.1')
+ v.should be_an_instance_of(Chef::Version::Platform)
v.should be_a_kind_of(Chef::Version)
end
+
+ it "should transform 1 to 1.0.0" do
+ Chef::Version::Platform.new("1").to_s.should == "1.0.0"
+ end
describe "when creating valid Versions" do
- good_versions = %w(1.2 1.2.3 1000.80.50000 0.300.25 001.02.00003)
+ good_versions = %w(1 1.2 1.2.3 1000.80.50000 0.300.25 001.02.00003)
good_versions.each do |v|
it "should accept '#{v}'" do
- Chef::Version::Cookbook.new v
+ Chef::Version::Platform.new v
end
end
end
describe "when given bogus input" do
- bad_versions = ["1.2.3.4", "1.2.a4", "1", "a", "1.2 3", "1.2 a",
+ bad_versions = ["1.2.3.4", "1.2.a4", "a", "1.2 3", "1.2 a",
"1 2 3", "1-2-3", "1_2_3", "1.2_3", "1.2-3"]
- the_error = Chef::Exceptions::InvalidCookbookVersion
+ the_error = Chef::Exceptions::InvalidPlatformVersion
bad_versions.each do |v|
it "should raise #{the_error} when given '#{v}'" do
- lambda { Chef::Version::Cookbook.new v }.should raise_error(the_error)
+ lambda { Chef::Version::Platform.new v }.should raise_error(the_error)
end
end
end
+ describe "<=>" do
+
+ it "should equate versions 1 and 1.0.0" do
+ Chef::Version::Platform.new("1").should == Chef::Version::Platform.new("1.0.0")
+ end
+
+ end
+
end