Ticket #35394: patch-spec-unit-provider-package-macports_spec.rb.patch
File patch-spec-unit-provider-package-macports_spec.rb.patch, 3.0 KB (added by macports@…, 12 years ago) |
---|
-
spec/unit/provider/package/macports_spec.rb
describe provider_class do 30 30 it { should be_versionable } 31 31 end 32 32 33 describe "when listing all instances" , :'fails_on_ruby_1.9.2' => truedo33 describe "when listing all instances" do 34 34 it "should call port -q installed" do 35 35 provider_class.expects(:port).with("-q", :installed).returns("") 36 36 provider_class.instances … … describe provider_class do 45 45 provider_class.expects(:port).returns("foo @1.234.5_2") 46 46 provider_class.instances.size.should == 0 47 47 end 48 49 it "should ignore variants" do 50 provider_class.parse_installed_query_line("bar @1.0beta2_38_1+x11+java (active)"). 51 should == {:provider=>:macports, :revision=>"1", :name=>"bar", :ensure=>"1.0beta2_38"} 52 end 53 48 54 end 49 55 50 56 describe "when installing" do … … describe provider_class do 78 84 "1.2.3 2" 79 85 end 80 86 let :infoargs do 81 [" -q", :info, "--line", "--version", "--revision", resource_name]87 ["/opt/local/bin/port", "-q", :info, "--line", "--version", "--revision", resource_name] 82 88 end 83 89 84 90 it "should return nil when the package cannot be found" do 85 91 resource[:name] = resource_name 86 provider.expects(: port).returns("")92 provider.expects(:execute).with(infoargs, {:combine=>false}).returns("") 87 93 provider.latest.should == nil 88 94 end 89 95 90 96 it "should return the current version if the installed port has the same revision" do 91 97 current_hash[:revision] = "2" 92 provider.expects(: port).with(*infoargs).returns(new_info_line)98 provider.expects(:execute).with(infoargs, {:combine=>false}).returns(new_info_line) 93 99 provider.expects(:query).returns(current_hash) 94 100 provider.latest.should == current_hash[:ensure] 95 101 end 96 102 97 103 it "should return the new version_revision if the installed port has a lower revision" do 98 104 current_hash[:revision] = "1" 99 provider.expects(: port).with(*infoargs).returns(new_info_line)105 provider.expects(:execute).with(infoargs, {:combine=>false}).returns(new_info_line) 100 106 provider.expects(:query).returns(current_hash) 101 107 provider.latest.should == "1.2.3_2" 102 108 end 109 110 it "should return the newest version if the port is not installed" do 111 resource[:name] = resource_name 112 provider.expects(:execute).with(infoargs, {:combine=>false}).returns(new_info_line) 113 provider.expects(:execute).with(["/opt/local/bin/port", "-q", :installed, resource[:name]], {:combine=>false}).returns("") 114 provider.latest.should == "1.2.3_2" 115 end 103 116 end 104 117 105 118 describe "when updating a port" do … … describe provider_class do 111 124 provider.update 112 125 end 113 126 114 it "should execute port install if the port is not installed" , :'fails_on_ruby_1.9.2' => truedo127 it "should execute port install if the port is not installed" do 115 128 resource[:name] = resource_name 116 129 resource[:ensure] = :present 117 130 provider.stubs(:query).returns("")