fix broken tests, use returns instead of yields

This commit is contained in:
Zach Leslie 2013-05-13 21:23:07 -07:00
parent c27d3c51d2
commit 843f9cf285
2 changed files with 18 additions and 3 deletions

View File

@ -12,7 +12,7 @@ Puppet::Type.type(:package).provide :pkgng, :parent => Puppet::Provider::Package
begin
output = pkg(['info','-a'])
if output == nil
unless output
return packages
end

View File

@ -25,17 +25,32 @@ describe provider_class do
end
it "should return the empty set if no packages are listed" do
provider_class.expects(:pkg).with(['info','-a']).yields('')
provider_class.expects(:pkg).with(['info','-a']).returns('')
provider_class.instances.should be_empty
end
it "should return all packages when invoked" do
fixture = File.read('spec/fixtures/pkg.info')
provider_class.expects(:pkg).with(['info','-a']).yields(fixture)
provider_class.expects(:pkg).with(['info','-a']).returns(fixture)
provider_class.instances.map(&:name).sort.should ==
%w{GeoIP ca_root_nss curl nginx nmap openldap-sasl-client pkg postfix ruby sudo tmux vim-lite zfs-stats zsh}.sort
end
end
context "#install" do
it "should fail if pkg.conf is not readable" do
end
end
context "#query" do
it "should return the installed version if present" do
end
it "should return nothing if not present" do
#provider.resource[:name] = 'bash'
#provider.expects(:pkg).with('zsh').returns('')
end
end
end