blob: 79d18144d675ac0c3359c5ec71c62a6c00a44c14 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#! /usr/bin/env ruby
require 'spec_helper'
describe Puppet::Type.type(:service).provider(:windows), '(integration)',
:if => Puppet.features.microsoft_windows? do
require 'puppet/util/windows'
before :each do
Puppet::Type.type(:service).stubs(:defaultprovider).returns described_class
end
context 'should fail querying services that do not exist' do
let(:service) do
Puppet::Type.type(:service).new(:name => 'foobarservice1234')
end
it "with a Puppet::Error when querying enabled?" do
expect { service.provider.enabled? }.to raise_error(Puppet::Error)
end
it "with a Puppet::Error when querying status" do
expect { service.provider.status }.to raise_error(Puppet::Error)
end
end
context 'should return valid values when querying a service that does exist' do
let(:service) do
Puppet::Type.type(:service).new(:name => 'lmhosts')
end
it "with a valid boolean when asked if enabled" do
expect([:true, :false]).to include(service.provider.enabled?)
end
it "with a valid status when asked about status" do
expect([
:running,
:'continue pending',
:'pause pending',
:paused,
:running,
:'start pending',
:'stop pending',
:stopped]).to include(service.provider.status)
end
end
end
|