Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow hash keys to be set to undef #60

Merged
merged 1 commit into from
Jan 10, 2015

Conversation

bodepd
Copy link
Contributor

@bodepd bodepd commented Jan 5, 2015

This patch protects against the case where
hash values happen to be set to :undef (Puppet's
nilish representation). Previously, having nil
values set to null caused a stack trace, now,
with this patch, those hash values are simply
dropped.

It also gets rid of some trailing white-spaces

@solarkennedy
Copy link
Contributor

Great! Can you add a test to ensure this works fully and will continue to work?

Something like...

context "handles undef correctly" do
  let(:params) => {{
    config_hash => {
       something => 'undef'? (maybe :undef ?)
    }
  }}
  it { should compile }
  it { should_not contain_file('consul.json').with_content(/: undef/)? }
end

This patch protects against the case where
hash values happen to be set to :undef (Puppet's
nilish representation). Previously, having nil
values set to null caused a stack trace, now,
with this patch, those hash values are simply
dropped.

It also gets rid of some trailing white-spaces and adds
some initial tests for the consul_sorted_json function.
@bodepd bodepd force-pushed the dont_fail_json_sort_on_fail branch from 03ee029 to 0a33716 Compare January 6, 2015 11:54
@solarkennedy
Copy link
Contributor

Nice!

solarkennedy added a commit that referenced this pull request Jan 10, 2015
@solarkennedy solarkennedy merged commit 31a8017 into voxpupuli:master Jan 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants