summaryrefslogtreecommitdiff
path: root/spec/unit/version_constraint_spec.rb
diff options
context:
space:
mode:
authorClaire McQuin <mcquin@users.noreply.github.com>2014-06-09 14:47:56 -0700
committerClaire McQuin <mcquin@users.noreply.github.com>2014-06-09 14:47:56 -0700
commit143f1b34a506bc95a002f52932c0686eb94ac727 (patch)
tree7ca5b6e04a5bf664997d36877fcc5c6511dc8fdb /spec/unit/version_constraint_spec.rb
parent460a4189164ce693bc35608f7563dc770c543b1b (diff)
parent8bb2677db528ad0a74faa439decf4321260d5b53 (diff)
downloadchef-143f1b34a506bc95a002f52932c0686eb94ac727.tar.gz
Merge pull request #848 from onddo/CHEF-4298
[CHEF-4298] dependencies in metadata.rb require a space
Diffstat (limited to 'spec/unit/version_constraint_spec.rb')
-rw-r--r--spec/unit/version_constraint_spec.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/spec/unit/version_constraint_spec.rb b/spec/unit/version_constraint_spec.rb
index a49b082d9d..4184689e2b 100644
--- a/spec/unit/version_constraint_spec.rb
+++ b/spec/unit/version_constraint_spec.rb
@@ -20,8 +20,8 @@ require 'chef/version_constraint'
describe Chef::VersionConstraint do
describe "validation" do
- bad_version = ["> >", ">= 1.2.z", "> 1.2.3 < 5.0", "> 1.2.3, < 5.0"]
- bad_op = ["<3.0.1", ">$ 1.2.3", "! 3.4"]
+ bad_version = [">= 1.2.z", "> 1.2.3 < 5.0", "> 1.2.3, < 5.0"]
+ bad_op = ["> >", ">$ 1.2.3", "! 3.4"]
o_error = Chef::Exceptions::InvalidVersionConstraint
v_error = Chef::Exceptions::InvalidCookbookVersion
bad_version.each do |s|
@@ -64,6 +64,18 @@ describe Chef::VersionConstraint do
vc.version.should be_an_instance_of(Chef::Version)
end
+ it "should allow ops without space separator" do
+ Chef::VersionConstraint.new("=1.2.3").should eql(Chef::VersionConstraint.new("= 1.2.3"))
+ Chef::VersionConstraint.new(">1.2.3").should eql(Chef::VersionConstraint.new("> 1.2.3"))
+ Chef::VersionConstraint.new("<1.2.3").should eql(Chef::VersionConstraint.new("< 1.2.3"))
+ Chef::VersionConstraint.new(">=1.2.3").should eql(Chef::VersionConstraint.new(">= 1.2.3"))
+ Chef::VersionConstraint.new("<=1.2.3").should eql(Chef::VersionConstraint.new("<= 1.2.3"))
+ end
+
+ it "should allow ops with multiple spaces" do
+ Chef::VersionConstraint.new("= 1.2.3").should eql(Chef::VersionConstraint.new("= 1.2.3"))
+ end
+
describe "include?" do
describe "handles various input data types" do
before do