For acceptance tests of components that involve peekAll
, I've stubbed the store
service with the peekAll
method that returns an array of Ember.Object
, by which I'm able to retrieve the records and display.
But save
, set
and get
methods aren't working, as peekAll
in it's original form returns a RecordArray
.
How do I return a RecordArray
from the store stub?
Instead of mocking the store service, it might be preferable to inject it, and then use
createRecord
to add your test record to the store. Then thepeekAll
will get aRecordArray
as per usual, which will include all of the appropriate methods. Otherwise you end up going down a bit of a rabbithole creating more and more mock functions (for example, you could createsave
,set
andget
methods, and add them to your EmberObject, but what about the next function you need...).