@corrspt wrote:
Hi all,
I’ve been trying to setup an acceptance test using
ember-cli-mirage
, but I’ve hit a roadblock. I’ve got a model, calledpqr
with a relation (one to one) to a model calledpqr-standard
.I’ve defined a set of fixtures for
pqr-standard
as they are mostly fixed. I want to create an acceptance test that visitspqr/:id
and comes with a pre-selectedstandard
(as the presence of a given standard influences some parts of my form)My thinking was something like:
server.loadFixtures(); server.create('pqr', { standard: ''} ) <---- Here lies the problem
I would like to load one of the fixture values in the
standard
property. I’ve tried making this work on the route handler side, but no luckthis.get('/pqrs/1', function({ db }, request) { let pqr = db.pqrs.insert({ standard: db.pqrStandards[0] }); return pqr; });
I’ve tried making on the acceptance-test file, by making a new
server.create('pqr-standard')
(and using it when creating the pqr) and the value is added to mirage’s database, but in my form I don’t see the value for the standard I’ve created.So my questions are: How can I use, server.create(‘model’) and pass it an attribute which is a fixture? Or am I doing something wrong here?
Thanks!
Posts: 1
Participants: 1