{"action":"created","issue":{"url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/112","labels_url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/112/labels{/name}","comments_url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/112/comments","events_url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/112/events","html_url":"https://github.com/samselikoff/ember-cli-mirage/issues/112","id":70528996,"number":112,"title":"Document how to test Ember Service","user":{"login":"eccegordo","id":497659,"avatar_url":"https://avatars.githubusercontent.com/u/497659?v=3","gravatar_id":"","url":"https://api.github.com/users/eccegordo","html_url":"https://github.com/eccegordo","followers_url":"https://api.github.com/users/eccegordo/followers","following_url":"https://api.github.com/users/eccegordo/following{/other_user}","gists_url":"https://api.github.com/users/eccegordo/gists{/gist_id}","starred_url":"https://api.github.com/users/eccegordo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eccegordo/subscriptions","organizations_url":"https://api.github.com/users/eccegordo/orgs","repos_url":"https://api.github.com/users/eccegordo/repos","events_url":"https://api.github.com/users/eccegordo/events{/privacy}","received_events_url":"https://api.github.com/users/eccegordo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-04-23T22:29:12Z","updated_at":"2015-05-24T03:53:56Z","closed_at":null,"body":"Curious how you might setup an acceptance test for a service?\r\n\r\nImagine a hypothetical service like this (note the ajax request)\r\n\r\n```\r\n// app/services/my-service.js\r\nimport Ember from 'ember';\r\n\r\nexport default Ember.Service.extend({\r\n\r\n  setup: Ember.on('init', function() {\r\n    var self = this;\r\n    var serviceData = Ember.$.ajax('/api/my-service-endpoint');\r\n    serviceData.then(function(result){\r\n      self.set('foo', result.foo);\r\n      self.set('bar', result.bar);\r\n    });\r\n    self._super();\r\n  }),\r\n  \r\n  foo: null,\r\n  bar: null\r\n\r\n});\r\n\r\n```\r\n\r\nIs there anything special you would need to do to get this working within an acceptance test?\r\nPresumably it work with normal server semantics\r\n```\r\ntest('it fetches data from service', function() {\r\n   server.createList('myService', 1);\r\n   andThen(function() {\r\n     // ... test that service data is work in your controller, route, component, etc\r\n   });\r\n});\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/comments/104975977","html_url":"https://github.com/samselikoff/ember-cli-mirage/issues/112#issuecomment-104975977","issue_url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/112","id":104975977,"user":{"login":"samselikoff","id":2922250,"avatar_url":"https://avatars.githubusercontent.com/u/2922250?v=3","gravatar_id":"","url":"https://api.github.com/users/samselikoff","html_url":"https://github.com/samselikoff","followers_url":"https://api.github.com/users/samselikoff/followers","following_url":"https://api.github.com/users/samselikoff/following{/other_user}","gists_url":"https://api.github.com/users/samselikoff/gists{/gist_id}","starred_url":"https://api.github.com/users/samselikoff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samselikoff/subscriptions","organizations_url":"https://api.github.com/users/samselikoff/orgs","repos_url":"https://api.github.com/users/samselikoff/repos","events_url":"https://api.github.com/users/samselikoff/events{/privacy}","received_events_url":"https://api.github.com/users/samselikoff/received_events","type":"User","site_admin":false},"created_at":"2015-05-24T03:53:56Z","updated_at":"2015-05-24T03:53:56Z","body":"@eccegordo did you try this?"}}