Skip to content

Commit

Permalink
(PUP-12077) Clean up rich_data resource specs
Browse files Browse the repository at this point in the history
  • Loading branch information
justinstoller committed Sep 17, 2024
1 parent 9f61d16 commit 8633e94
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions spec/unit/resource_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -910,14 +910,15 @@ def inject_and_set_defaults(resource, scope)
require 'puppet_spec/compiler'
include PuppetSpec::Compiler

it 'should do something' do
it 'serializes rich data' do
resource = compile_to_catalog('notify {"foo": message => Deferred("func", ["a", "b", "c"])}')

# This should be true by default
if Puppet[:rich_data]
expect(resource.to_data_hash.class).to be(Hash)
end
# This assume rich_data is true by default
expect(resource.to_data_hash.class).to be(Hash)
end

it 'raises when rich data is disabled' do
resource = compile_to_catalog('notify {"foo": message => Deferred("func", ["a", "b", "c"])}')
expect {
Puppet.override(rich_data: false) do
resource.to_data_hash
Expand Down

0 comments on commit 8633e94

Please sign in to comment.