Skip to content
This repository has been archived by the owner on Mar 19, 2022. It is now read-only.

Generate JSON in pretty form, and add ip address #360

Merged
merged 1 commit into from
Apr 26, 2014

Conversation

alexsiri7
Copy link
Contributor

Store the IP address from the node in the node file. Also, pretty print the JSON so it's easier to manipulate.

@@ -114,7 +156,17 @@ def test_generates_a_node_config_with_specified_run_list_and_attributes
run_list = 'recipe[baz]'
cmd = command(@host, "--run-list=#{run_list}", "--json-attributes={#{foo_json}}")
cmd.generate_node_config
assert_match "{#{foo_json},\"run_list\":[\"#{run_list}\"]}", cmd.node_config.read

expected_hash = {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This repeated pattern in the test has a bit of smell to it. Thinking we should have some sort of helper here that allows for testing only the part of the json we're interested in for a given test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I felt the same way. I'll refactor this. I was thinking something like

assert_config_contains expected_hash, cmd

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, you can see the updated code below

@matschaffer matschaffer added this to the 0.4.2 milestone Apr 21, 2014
matschaffer added a commit that referenced this pull request Apr 26, 2014
Generate JSON in pretty form, and add ip address
@matschaffer matschaffer merged commit dec9162 into matschaffer:master Apr 26, 2014
@matschaffer
Copy link
Owner

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants