Skip to content

Commit d97c38a

Browse files
committed
yuck
1 parent 9d1ba7e commit d97c38a

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

spec/unit/provider/package/openbsd_spec.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,35 @@
1515
before :each do
1616
# Stub some provider methods to avoid needing the actual software
1717
# installed, so we can test on whatever platform we want.
18-
allow(described_class).to receive(:command).with(:pkginfo).and_return('/bin/pkg_info')
19-
allow(described_class).to receive(:command).with(:pkgadd).and_return('/bin/pkg_add')
20-
allow(described_class).to receive(:command).with(:pkgdelete).and_return('/bin/pkg_delete')
18+
allow(described_class).to receive(:command).with(:pkginfo).and_return('/usr/sbin/pkg_info')
19+
allow(described_class).to receive(:command).with(:pkgadd).and_return('/usr/sbin/pkg_add')
20+
allow(described_class).to receive(:command).with(:pkgdelete).and_return('/usr/sbin/pkg_delete')
2121

2222
allow(Puppet::FileSystem).to receive(:exist?)
2323
end
2424

2525
context "#instances" do
2626
it "should return nil if execution failed" do
27-
expect(described_class).to receive(:pkgadd).and_raise(Puppet::ExecutionFailure, 'wawawa')
27+
expect(provider).to receive(:pkginfo).and_raise(Puppet::ExecutionFailure, 'wawawa')
2828
expect(described_class.instances).to be_nil
2929
end
3030

3131
it "should return the empty set if no packages are listed" do
32-
expect(described_class).to receive(:execpipe).with(%w{/bin/pkg_info -a}).and_yield(StringIO.new(''))
32+
expect(described_class).to receive(:execpipe).with(%w{/usr/sbin/pkg_info -a}).and_yield(StringIO.new(''))
3333
expect(described_class.instances).to be_empty
3434
end
3535

3636
it "should return all packages when invoked" do
3737
fixture = File.read(my_fixture('pkginfo.list'))
38-
expect(described_class).to receive(:execpipe).with(%w{/bin/pkg_info -a -z}).and_yield(fixture)
38+
expect(described_class).to receive(:execpipe).with(%w{/usr/sbin/pkg_info -a -z}).and_yield(fixture)
3939
expect(described_class.instances.map(&:name).sort).to eq(
4040
%w{autoconf%2.13 autoconf%2.56 bash postfix%stable puppet%8}.sort
4141
)
4242
end
4343

4444
it "should return all flavors if set" do
4545
fixture = File.read(my_fixture('pkginfo.list'))
46-
expect(described_class).to receive(:execpipe).with(%w{/bin/pkg_info -a -z}).and_yield(fixture)
46+
expect(described_class).to receive(:execpipe).with(%w{/usr/sbin/pkg_info -a -z}).and_yield(fixture)
4747
instances = described_class.instances.map {|p| {:name => p.get(:name),
4848
:ensure => p.get(:ensure), :flavor => p.get(:flavor)}}
4949
expect(instances.size).to eq(2)
@@ -84,15 +84,15 @@
8484

8585
it "should lookup the correct version" do
8686
output = 'bash-3.1.17 GNU Bourne Again Shell'
87-
expect(provider).to receive(:execpipe).with(%w{/bin/pkg_info -I bash}).and_yield(output)
87+
expect(provider).to receive(:execpipe).with(%w{/usr/sbin/pkg_info -I bash}).and_yield(output)
8888
expect(provider.get_full_name).to eq('bash-3.1.17')
8989
end
9090

9191
it "should lookup the correction version with flavors" do
9292
provider.resource[:name] = 'fossil'
9393
provider.resource[:flavor] = 'static'
9494
output = 'fossil-1.29v0-static simple distributed software configuration management'
95-
expect(provider).to receive(:execpipe).with(%w{/bin/pkg_info -I fossil}).and_yield(output)
95+
expect(provider).to receive(:execpipe).with(%w{/usr/sbin/pkg_info -I fossil}).and_yield(output)
9696
expect(provider.get_full_name).to eq('fossil-1.29v0-static')
9797
end
9898
end
@@ -105,13 +105,13 @@
105105

106106
it "should return the package version if in the output" do
107107
output = 'bash-3.1.17 GNU Bourne Again Shell'
108-
expect(provider).to receive(:execpipe).with(%w{/bin/pkg_info -I bash}).and_yield(output)
108+
expect(provider).to receive(:execpipe).with(%w{/usr/sbin/pkg_info -I bash}).and_yield(output)
109109
expect(provider.get_version).to eq('3.1.17')
110110
end
111111

112112
it "should return the empty string if the package is not present" do
113113
provider.resource[:name] = 'zsh'
114-
expect(provider).to receive(:execpipe).with(%w{/bin/pkg_info -I zsh}).and_yield(StringIO.new(''))
114+
expect(provider).to receive(:execpipe).with(%w{/usr/sbin/pkg_info -I zsh}).and_yield(StringIO.new(''))
115115
expect(provider.get_version).to eq('')
116116
end
117117
end

0 commit comments

Comments
 (0)