File: taskscheduler_spec.rb

package info (click to toggle)
ruby-rspec-puppet 2.9.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,416 kB
  • sloc: ruby: 6,661; makefile: 6
file content (51 lines) | stat: -rw-r--r-- 1,159 bytes parent folder | download | duplicates (2)
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
49
50
51
require 'spec_helper'

describe ::Win32::TaskScheduler do
  subject { described_class }

  let(:stub_class) { RSpec::Puppet::Win32::TaskScheduler }


  context 'on non-windows', :unless => windows? do
    it { should_not be_nil }

    it 'uses the stubbed rspec-puppet version' do
      should eq(stub_class)
    end
  end

  context 'on windows', :if => windows? do
    ignored_consts = [
      :VERSION,
      :FORMAT_MESSAGE_IGNORE_INSERTS,
      :FORMAT_MESSAGE_FROM_SYSTEM,
      :FORMAT_MESSAGE_MAX_WIDTH_MASK,
      :Error,
      :TaskSchedulerConstants,
      :IdleSettings,
      :SID,
      :Helper,
      :TimeCalcHelper,
      :BUILT_IN_GROUPS,
      :SERVICE_ACCOUNT_USERS,
      :ERROR_INSUFFICIENT_BUFFER,
      :SYSTEM_USERS,
    ]

    it { should_not be_nil }

    it 'does not use the stubbed rspec-puppet version' do
      should_not eq(stub_class)
    end

    described_class.constants.each do |const_name|
      next if ignored_consts.include?(const_name)

      context const_name.to_s do
        subject { described_class.const_get(const_name) }

        it { should eq(stub_class.const_get(const_name)) }
      end
    end
  end
end