{"action":"created","issue":{"url":"https://api.github.com/repos/chef/inspec/issues/809","repository_url":"https://api.github.com/repos/chef/inspec","labels_url":"https://api.github.com/repos/chef/inspec/issues/809/labels{/name}","comments_url":"https://api.github.com/repos/chef/inspec/issues/809/comments","events_url":"https://api.github.com/repos/chef/inspec/issues/809/events","html_url":"https://github.com/chef/inspec/pull/809","id":162809000,"number":809,"title":"expose resources inside of describe blocks","user":{"login":"arlimus","id":1307529,"avatar_url":"https://avatars.githubusercontent.com/u/1307529?v=3","gravatar_id":"","url":"https://api.github.com/users/arlimus","html_url":"https://github.com/arlimus","followers_url":"https://api.github.com/users/arlimus/followers","following_url":"https://api.github.com/users/arlimus/following{/other_user}","gists_url":"https://api.github.com/users/arlimus/gists{/gist_id}","starred_url":"https://api.github.com/users/arlimus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arlimus/subscriptions","organizations_url":"https://api.github.com/users/arlimus/orgs","repos_url":"https://api.github.com/users/arlimus/repos","events_url":"https://api.github.com/users/arlimus/events{/privacy}","received_events_url":"https://api.github.com/users/arlimus/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-06-28T23:19:08Z","updated_at":"2016-06-28T23:23:47Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/chef/inspec/pulls/809","html_url":"https://github.com/chef/inspec/pull/809","diff_url":"https://github.com/chef/inspec/pull/809.diff","patch_url":"https://github.com/chef/inspec/pull/809.patch"},"body":"Please find the initial user request here: https://github.com/chef/inspec/issues/451\r\n\r\ntldr:\r\n\r\n```ruby\r\ndescribe 'something...' do\r\n  # i can access resources vv\r\n  if os.redhat?\r\n    ...\r\n  end\r\nend\r\n```\r\n\r\nIn this example ^^ the resource `os` is currently not available inside of a `describe` block.\r\n\r\nFixes https://github.com/chef/inspec/issues/451\r\n\r\nLet's pick the discussion back up in here. I'm not sure at this point whether we should actually get this feature into inspec.\r\n\r\n==\r\n\r\nRSpec in its pure form did not allow for this. What we are starting to do, is to get our own resource keywords inside of `describe` blocks. This may lead to clashes in the namespace (ie resource names colliding with rspec functions), which is virtually impossible to resolve.\r\n\r\nIt is possible in its traditional application to define terms outside the block and use them, which also works in inspec:\r\n\r\n```ruby\r\nval = os.redhat?\r\ndescribe 'my test' do\r\n  if val\r\n    it { should eq true }\r\n  end\r\nend\r\n```\r\n\r\n(although obviously a better choice would be to use inspec's `supports` flag ...)\r\n\r\nThe question now becomes, is it worth diluting the DSL inside the describe block to get this in. i.e. what are the use-cases we are trying to solve?\r\n\r\nPlease help with this discussion"},"comment":{"url":"https://api.github.com/repos/chef/inspec/issues/comments/229213820","html_url":"https://github.com/chef/inspec/pull/809#issuecomment-229213820","issue_url":"https://api.github.com/repos/chef/inspec/issues/809","id":229213820,"user":{"login":"arlimus","id":1307529,"avatar_url":"https://avatars.githubusercontent.com/u/1307529?v=3","gravatar_id":"","url":"https://api.github.com/users/arlimus","html_url":"https://github.com/arlimus","followers_url":"https://api.github.com/users/arlimus/followers","following_url":"https://api.github.com/users/arlimus/following{/other_user}","gists_url":"https://api.github.com/users/arlimus/gists{/gist_id}","starred_url":"https://api.github.com/users/arlimus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arlimus/subscriptions","organizations_url":"https://api.github.com/users/arlimus/orgs","repos_url":"https://api.github.com/users/arlimus/repos","events_url":"https://api.github.com/users/arlimus/events{/privacy}","received_events_url":"https://api.github.com/users/arlimus/received_events","type":"User","site_admin":false},"created_at":"2016-06-28T23:23:47Z","updated_at":"2016-06-28T23:23:47Z","body":"This change may not be very large, but it took a while to get working. It carries some heavy implications, i.e. let's treat this with care."}}
{"actor":{"display_login":"arlimus"}}