{"action":"created","issue":{"url":"https://api.github.com/repos/phutchins/chef-sar/issues/3","labels_url":"https://api.github.com/repos/phutchins/chef-sar/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/phutchins/chef-sar/issues/3/comments","events_url":"https://api.github.com/repos/phutchins/chef-sar/issues/3/events","html_url":"https://github.com/phutchins/chef-sar/pull/3","id":106689118,"number":3,"title":"Add ChefSpec unit test for package install and config file creation","user":{"login":"newatlantis","id":788560,"avatar_url":"https://avatars.githubusercontent.com/u/788560?v=3","gravatar_id":"","url":"https://api.github.com/users/newatlantis","html_url":"https://github.com/newatlantis","followers_url":"https://api.github.com/users/newatlantis/followers","following_url":"https://api.github.com/users/newatlantis/following{/other_user}","gists_url":"https://api.github.com/users/newatlantis/gists{/gist_id}","starred_url":"https://api.github.com/users/newatlantis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/newatlantis/subscriptions","organizations_url":"https://api.github.com/users/newatlantis/orgs","repos_url":"https://api.github.com/users/newatlantis/repos","events_url":"https://api.github.com/users/newatlantis/events{/privacy}","received_events_url":"https://api.github.com/users/newatlantis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-09-16T03:07:49Z","updated_at":"2015-09-16T16:44:57Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/phutchins/chef-sar/pulls/3","html_url":"https://github.com/phutchins/chef-sar/pull/3","diff_url":"https://github.com/phutchins/chef-sar/pull/3.diff","patch_url":"https://github.com/phutchins/chef-sar/pull/3.patch"},"body":"Philip,\r\n\r\nI think I read somewhere that you shouldn't write Chef cookbook unit tests that simply verify that a recipe does what you told it to do. I interpreted that person -- can't remember where I read it -- to be saying, if you do \"package <package>\" in your recipe, don't write a unit test the confirms that your recipe installs <package>, because in doing so, you're just testing that Chef does what it's supposed to do. And Chef itself has plenty of tests of itself already.\r\n\r\nI'm new to Chef, but I don't look at it like that. I like the idea of a unit test's being \"executable requirements\" for a recipe, verifying that the recipe does everything it's supposed to. That way, if in future somebody modifies the recipe and accidentally deletes some aspect of it that's important, the unit test will catch it.\r\n\r\nAnyway, I put together a unit test for the sar cookbook's default recipe that simply checks that it does in fact install sysstat and create each of two config files. It's no big deal now, but if/as the cookbook gets expanded to do more (support more platforms), I'm thinking it might be useful.\r\n\r\nI'd appreciate any tips or criticisms you might have about it, so I can learn to write ChefSpec tests better.\r\n\r\nThanks,\r\n\r\n--Linc Abbey"},"comment":{"url":"https://api.github.com/repos/phutchins/chef-sar/issues/comments/140798691","html_url":"https://github.com/phutchins/chef-sar/pull/3#issuecomment-140798691","issue_url":"https://api.github.com/repos/phutchins/chef-sar/issues/3","id":140798691,"user":{"login":"phutchins","id":1074345,"avatar_url":"https://avatars.githubusercontent.com/u/1074345?v=3","gravatar_id":"","url":"https://api.github.com/users/phutchins","html_url":"https://github.com/phutchins","followers_url":"https://api.github.com/users/phutchins/followers","following_url":"https://api.github.com/users/phutchins/following{/other_user}","gists_url":"https://api.github.com/users/phutchins/gists{/gist_id}","starred_url":"https://api.github.com/users/phutchins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phutchins/subscriptions","organizations_url":"https://api.github.com/users/phutchins/orgs","repos_url":"https://api.github.com/users/phutchins/repos","events_url":"https://api.github.com/users/phutchins/events{/privacy}","received_events_url":"https://api.github.com/users/phutchins/received_events","type":"User","site_admin":false},"created_at":"2015-09-16T16:44:57Z","updated_at":"2015-09-16T16:44:57Z","body":"You can leave it as it is. I'm more concerned with the end result and sometimes its nice to have the granularity of individual commits..."}}