Skip to content

Commit

Permalink
Update specs for scheduleddowntime object
Browse files Browse the repository at this point in the history
  • Loading branch information
bobapple committed Feb 21, 2017
1 parent cbc7886 commit 408aa74
Showing 1 changed file with 25 additions and 12 deletions.
37 changes: 25 additions & 12 deletions spec/defines/scheduleddowntime_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,16 @@
.with_content(/duration = 30m/) }
end

# See: https://github.com/Icinga/puppet-icinga2/pull/220#issuecomment-275847137
# context "#{os} with duration => foo (not a valid integer)" do
# let(:params) { {:duration => 'foo', :target => '/bar/baz',
# :host_name => 'foohost',
# :author => 'fooauthor',
# :comment => 'foocomment',
# :ranges => { 'foo' => "bar", 'bar' => "foo"}} }
#
# it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) }
# end

context "#{os} with duration => foo (not a valid integer)" do
let(:params) { {:duration => 'foo', :target => '/bar/baz',
:host_name => 'foohost',
:author => 'fooauthor',
:comment => 'foocomment',
:ranges => { 'foo' => "bar", 'bar' => "foo"}} }

it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) }
end


context "#{os} with ranges => { foo => 'bar', bar => 'foo' }" do
Expand Down Expand Up @@ -287,14 +287,27 @@
end


context "Windows 2012 R2 with duration => 30m" do
let(:params) { {:duration => '30m', :target => 'C:/bar/baz',
:host_name => 'foohost',
:author => 'fooauthor',
:comment => 'foocomment',
:ranges => { 'foo' => "bar", 'bar' => "foo"}} }

it { is_expected.to contain_concat__fragment('icinga2::object::ScheduledDowntime::bar')
.with({'target' => 'C:/bar/baz'})
.with_content(/duration = 30m/) }
end


context "Windows 2012 R2 with duration => foo (not a valid integer)" do
let(:params) { {:duration => 'foo', :target => 'C:/bar/baz',
let(:params) { {:duration => 'foo', :target => '/bar/baz',
:host_name => 'foohost',
:author => 'fooauthor',
:comment => 'foocomment',
:ranges => { 'foo' => "bar", 'bar' => "foo"}} }

it { is_expected.to raise_error(Puppet::Error, /first argument to be an Integer/) }
it { is_expected.to raise_error(Puppet::Error, /"foo" does not match/) }
end


Expand Down

0 comments on commit 408aa74

Please sign in to comment.