{"action":"created","issue":{"url":"https://api.github.com/repos/evilmartians/chef-prometheus-exporters/issues/11","repository_url":"https://api.github.com/repos/evilmartians/chef-prometheus-exporters","labels_url":"https://api.github.com/repos/evilmartians/chef-prometheus-exporters/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/evilmartians/chef-prometheus-exporters/issues/11/comments","events_url":"https://api.github.com/repos/evilmartians/chef-prometheus-exporters/issues/11/events","html_url":"https://github.com/evilmartians/chef-prometheus-exporters/issues/11","id":359558845,"node_id":"MDU6SXNzdWUzNTk1NTg4NDU=","number":11,"title":"chefspec redis_exporter","user":{"login":"bliuchak","id":1957659,"node_id":"MDQ6VXNlcjE5NTc2NTk=","avatar_url":"https://avatars3.githubusercontent.com/u/1957659?v=4","gravatar_id":"","url":"https://api.github.com/users/bliuchak","html_url":"https://github.com/bliuchak","followers_url":"https://api.github.com/users/bliuchak/followers","following_url":"https://api.github.com/users/bliuchak/following{/other_user}","gists_url":"https://api.github.com/users/bliuchak/gists{/gist_id}","starred_url":"https://api.github.com/users/bliuchak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bliuchak/subscriptions","organizations_url":"https://api.github.com/users/bliuchak/orgs","repos_url":"https://api.github.com/users/bliuchak/repos","events_url":"https://api.github.com/users/bliuchak/events{/privacy}","received_events_url":"https://api.github.com/users/bliuchak/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-09-12T16:26:08Z","updated_at":"2018-12-03T18:58:06Z","closed_at":"2018-12-03T18:58:05Z","author_association":"NONE","body":"Hello,\r\n\r\nI'd like to test `redis_exporter` resource in my cookbook using chefspec. But I've encountered with a problem that I can't find action matcher for it.\r\n\r\n```rb\r\nit 'install prometheus redis exporter' do\r\n  expect(chef_run).to install_redis_exporter('main')\r\nend\r\n```\r\n\r\nWith code above I've got next error\r\n```bash\r\nFailures:\r\n\r\n  1) xxxxx_redis::default When all attributes are default, on centos-7.3.1611 install prometheus redis exporter\r\n     Failure/Error: expect(chef_run).to install_redis_exporter('main')\r\n\r\n     NoMethodError:\r\n       undefined method `install_redis_exporter' for #<RSpec::ExampleGroups::xxxxxRedisDefault::WhenAllAttributesAreDefaultOnCentos731611:0x007fb0abce0c08>\r\n       Did you mean?  install_windows_feature\r\n     # ./spec/unit/recipes/default_spec.rb:77:in `block (3 levels) in <top (required)>'\r\n```\r\n\r\nCould someone please point me what I'm doing wrong?\r\n\r\nI'm using:\r\n- cookbook `depends 'prometheus_exporters', '~> 0.6.1'`\r\n- Chef Development Kit Version: 1.4.3\r\n- chef-client version: 13.5.3\r\n- delivery version: master (41b94ffb5efd33723cf72a89bf4d273c8151c9dc)\r\n- berks version: 6.3.1\r\n- kitchen version: 1.16.0\r\n- inspec version: 1.25.1"},"comment":{"url":"https://api.github.com/repos/evilmartians/chef-prometheus-exporters/issues/comments/443827304","html_url":"https://github.com/evilmartians/chef-prometheus-exporters/issues/11#issuecomment-443827304","issue_url":"https://api.github.com/repos/evilmartians/chef-prometheus-exporters/issues/11","id":443827304,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MzgyNzMwNA==","user":{"login":"dragonsmith","id":511416,"node_id":"MDQ6VXNlcjUxMTQxNg==","avatar_url":"https://avatars0.githubusercontent.com/u/511416?v=4","gravatar_id":"","url":"https://api.github.com/users/dragonsmith","html_url":"https://github.com/dragonsmith","followers_url":"https://api.github.com/users/dragonsmith/followers","following_url":"https://api.github.com/users/dragonsmith/following{/other_user}","gists_url":"https://api.github.com/users/dragonsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/dragonsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dragonsmith/subscriptions","organizations_url":"https://api.github.com/users/dragonsmith/orgs","repos_url":"https://api.github.com/users/dragonsmith/repos","events_url":"https://api.github.com/users/dragonsmith/events{/privacy}","received_events_url":"https://api.github.com/users/dragonsmith/received_events","type":"User","site_admin":false},"created_at":"2018-12-03T18:58:04Z","updated_at":"2018-12-03T18:58:04Z","author_association":"MEMBER","body":"@bliuchak hello!\r\n\r\nSorry for such a long response.\r\n\r\nIn fact, I was ignoring ChefSpec for quite a long time in favor of InSpec, so I may have a limited context, but I think you running your test not in a proper way or something.\r\n\r\nI've peeked into [examples](https://github.com/chefspec/chefspec/tree/master/examples/) and it turns out the current ChefSpec autogenerates matchers.\r\n\r\nHere is my implementation of the tests: https://github.com/evilmartians/chef-prometheus-exporters/blob/master/test/cookbooks/testrig/spec/chefspec.rb\r\n\r\nI've bumped into two things during my short research:\r\n1. I had to invoke `ChefSpec::Runner` to get matcher methods.\r\n2. `rspec` should be [invoked from the root directory](https://github.com/evilmartians/chef-prometheus-exporters/blob/master/.travis.yml) for Berkshelf to resolve correctly.\r\n\r\nI hope that helps! Thank you for using my cookbook and providing a feedback!\r\n"}}
{"actor":{"display_login":"dragonsmith"}}