vendredi 13 novembre 2015

Get model of route after visiting it in acceptance test

I'm trying to write an acceptance test to see if a certain property in the model for the route I visit equals what I am asserting.

In the acceptance test I have this setup (using mirage btw)

test('Returns a user', function(assert) {
  // Generate a user
  var user = server.create('user',{first_name: 'Jordan'});
  // Visit the index page with the users short_url
  visit('/' + user.short_url);
  var route = this.application.__container__.lookup('route:index');

  // Assert that the model the user we created by checking the first name we passed in
  assert.equal(route.model.first_name,'Jordan','Model returns user with first name Jordan');
});

But when I run the test it shows the result as being undefined




Aucun commentaire:

Enregistrer un commentaire