diff options
author | Matthew Kent <mkent@magoazul.com> | 2011-05-03 08:56:55 -0700 |
---|---|---|
committer | Bryan McLellan <btm@opscode.com> | 2011-05-19 18:05:36 -0700 |
commit | 0bd9272b1c678cbad401e8cd5096e168dd5b3b95 (patch) | |
tree | 5b52437a41c9ed333ad0922427adbf2594530f3b /chef/spec | |
parent | e9958a76ac12a6d70d1884f2600f7feb3a329b9d (diff) | |
download | chef-0bd9272b1c678cbad401e8cd5096e168dd5b3b95.tar.gz |
CHEF-2283: Support an already parsed version for speed.
Diffstat (limited to 'chef/spec')
-rw-r--r-- | chef/spec/unit/provider/package/yum_spec.rb | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/chef/spec/unit/provider/package/yum_spec.rb b/chef/spec/unit/provider/package/yum_spec.rb index 05a543d4f2..fde3f2f976 100644 --- a/chef/spec/unit/provider/package/yum_spec.rb +++ b/chef/spec/unit/provider/package/yum_spec.rb @@ -359,7 +359,7 @@ describe Chef::Provider::Package::Yum::RPMUtils do end describe Chef::Provider::Package::Yum::RPMPackage do - describe "new" do + describe "new - with parsing" do before do @rpm = Chef::Provider::Package::Yum::RPMPackage.new("testing", "1:1.6.5-9.36.el5", "x86_64") end @@ -379,6 +379,38 @@ describe Chef::Provider::Package::Yum::RPMPackage do end end + describe "new - no parsing" do + before do + @rpm = Chef::Provider::Package::Yum::RPMPackage.new("testing", "1", "1.6.5", "9.36.el5", "x86_64") + end + + it "should expose nevra (name-epoch-version-release-arch) available" do + @rpm.name.should == "testing" + @rpm.epoch.should == 1 + @rpm.version.should == "1.6.5" + @rpm.release.should == "9.36.el5" + @rpm.arch.should == "x86_64" + + @rpm.nevra.should == "testing-1:1.6.5-9.36.el5.x86_64" + end + + it "should output a version-release string" do + @rpm.to_s.should == "1.6.5-9.36.el5" + end + end + + it "should raise an error unless passed 3 or 5 args" do + lambda { + Chef::Provider::Package::Yum::RPMPackage.new() + }.should raise_error(ArgumentError) + lambda { + Chef::Provider::Package::Yum::RPMPackage.new("testing", "1:1.6.5-9.36.el5", "x86_64", "extra") + }.should raise_error(ArgumentError) + lambda { + Chef::Provider::Package::Yum::RPMPackage.new("testing", "1:1.6.5-9.36.el5", "x86_64", "extra", "extra", "extra") + }.should raise_error(ArgumentError) + end + # thanks version_class_spec.rb! describe "<=>" do it "should sort based on complete epoch-version-release data" do |