Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9343326
basic_spec.rb
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
basic_spec.rb
View Options
require
'spec_helper_system'
describe
'basic tests:'
do
# Using puppet_apply as a subject
context
puppet_apply
'notice("foo")'
do
its
(
:stdout
)
{
should
=~
/foo/
}
its
(
:stderr
)
{
should
be_empty
}
its
(
:exit_code
)
{
should
be_zero
}
end
# Using puppet_apply as a helper
it
'my class should work with no errors'
do
pp
=
<<-
EOS
datacat { "/tmp/demo1":
template_body => "<% @data.keys.sort.each do |k| %><%= k %>: <%= @data[k] %>, <% end %>",
}
datacat_fragment { "foo":
target => '/tmp/demo1',
data => { foo => "one" },
}
datacat_fragment { "bar":
target => '/tmp/demo1',
data => { bar => "two" },
}
exec { '/bin/echo I have changed':
refreshonly => true,
subscribe => Datacat["/tmp/demo1"],
}
EOS
# Run it twice and test for idempotency
puppet_apply
(
pp
)
do
|
r
|
r
.
exit_code
.
should_not
==
1
r
.
refresh
r
.
exit_code
.
should
be_zero
end
shell
(
'cat /tmp/demo1'
)
do
|
r
|
r
.
stdout
.
should
=~
/^bar: two, foo: one/
end
end
end
File Metadata
Details
Attached
Mime Type
text/x-ruby
Expires
Fri, Jul 4, 1:26 PM (6 d, 1 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3361854
Attached To
R151 puppet-richardc-datacat
Event Timeline
Log In to Comment