4

I am using ember-simple-auth with ember-cli. I can't figure out how to pass authentication during integration tests are running.

In my startApp I lookup for session from container then set isAuthenticated property to true but i guess it is not enough.

I reopen Session in initializer and add computed property user. For testing this one also should not look for store.

Session.reopen({
  user: function() {
    var userId = this.get('user_id');
    if (!Ember.isEmpty(userId)) {
      return container.lookup('store:main').find('user', userId);
    }
  }.property('userId')
});

And also I guess local-storage is not proper for testing so how to set store type to store:ephemeral when tests are running.

I could not find any complete tutorial or anything about writing integration test when using ember-cli and ember-simple-auth. Thanks in advance

saygun
  • 1,438
  • 12
  • 26
  • I'm currently working on some improvements for Ember Simple Auth's testability and also a tutorial on how to sea it up. – marcoow Jul 15 '14 at 08:19
  • If you have a road map I would love to contribute if I can – saygun Jul 15 '14 at 08:22
  • There's no road map really but you can checkout the testing branch: https://github.com/simplabs/ember-simple-auth/tree/testing – marcoow Jul 15 '14 at 08:44

1 Answers1

1

marcoow has now released the official Ember Simple Auth Testing library

Community
  • 1
  • 1
HeroicEric
  • 876
  • 5
  • 13