{"action":"closed","issue":{"url":"https://api.github.com/repos/ribbon/intercom/issues/19","labels_url":"https://api.github.com/repos/ribbon/intercom/issues/19/labels{/name}","comments_url":"https://api.github.com/repos/ribbon/intercom/issues/19/comments","events_url":"https://api.github.com/repos/ribbon/intercom/issues/19/events","html_url":"https://github.com/ribbon/intercom/issues/19","id":70248706,"number":19,"title":"Can't mock SDK methods in RSpec","user":{"login":"roberthoner","id":4632927,"avatar_url":"https://avatars.githubusercontent.com/u/4632927?v=3","gravatar_id":"","url":"https://api.github.com/users/roberthoner","html_url":"https://github.com/roberthoner","followers_url":"https://api.github.com/users/roberthoner/followers","following_url":"https://api.github.com/users/roberthoner/following{/other_user}","gists_url":"https://api.github.com/users/roberthoner/gists{/gist_id}","starred_url":"https://api.github.com/users/roberthoner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roberthoner/subscriptions","organizations_url":"https://api.github.com/users/roberthoner/orgs","repos_url":"https://api.github.com/users/roberthoner/repos","events_url":"https://api.github.com/users/roberthoner/events{/privacy}","received_events_url":"https://api.github.com/users/roberthoner/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"roberthoner","id":4632927,"avatar_url":"https://avatars.githubusercontent.com/u/4632927?v=3","gravatar_id":"","url":"https://api.github.com/users/roberthoner","html_url":"https://github.com/roberthoner","followers_url":"https://api.github.com/users/roberthoner/followers","following_url":"https://api.github.com/users/roberthoner/following{/other_user}","gists_url":"https://api.github.com/users/roberthoner/gists{/gist_id}","starred_url":"https://api.github.com/users/roberthoner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roberthoner/subscriptions","organizations_url":"https://api.github.com/users/roberthoner/orgs","repos_url":"https://api.github.com/users/roberthoner/repos","events_url":"https://api.github.com/users/roberthoner/events{/privacy}","received_events_url":"https://api.github.com/users/roberthoner/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/ribbon/intercom/milestones/9","html_url":"https://github.com/ribbon/intercom/milestones/0.3.0","labels_url":"https://api.github.com/repos/ribbon/intercom/milestones/9/labels","id":1086691,"number":9,"title":"0.3.0","description":"","creator":{"login":"roberthoner","id":4632927,"avatar_url":"https://avatars.githubusercontent.com/u/4632927?v=3","gravatar_id":"","url":"https://api.github.com/users/roberthoner","html_url":"https://github.com/roberthoner","followers_url":"https://api.github.com/users/roberthoner/followers","following_url":"https://api.github.com/users/roberthoner/following{/other_user}","gists_url":"https://api.github.com/users/roberthoner/gists{/gist_id}","starred_url":"https://api.github.com/users/roberthoner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roberthoner/subscriptions","organizations_url":"https://api.github.com/users/roberthoner/orgs","repos_url":"https://api.github.com/users/roberthoner/repos","events_url":"https://api.github.com/users/roberthoner/events{/privacy}","received_events_url":"https://api.github.com/users/roberthoner/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":10,"state":"open","created_at":"2015-04-28T03:33:14Z","updated_at":"2015-05-02T05:21:41Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2015-04-22T22:13:07Z","updated_at":"2015-05-02T05:21:41Z","closed_at":"2015-05-02T05:21:41Z","body":"RSpec won't let you mock methods unless the object responds to them. This is because SDK doesn't actually respond to any of the service methods (they're handled with method_missing).\r\n\r\nIn my testing, I was able to get this to work by adding a singleton method implementation of `respond_to?`:\r\n```ruby\r\nbefore {\r\n  Intercom[:analytics].define_singleton_method(:respond_to?) { |*args| true }\r\n}\r\n```\r\n\r\nPerhaps this can be done as part of the `mock_safe` method.\r\n"}}