vendredi 5 juin 2015

Ember CLI Simple Auth test helper authenticateSession is not defined

I am using ember-cli 0.2.6 and ember-cli-simple-auth 0.8.0-beta.2.

Starting from scratch I do the following:

ember create project1
//inside project1
ember install ember-cli-simple-auth

now i am adding the following line to tests/helpers/start-app:

import 'simple-auth-testing/test-helpers';

and in environment.js only add this:

if (environment === 'test') {
    ENV['simple-auth'] = {
      store: 'simple-auth-session-store:ephemeral'
    };
    ...
}

Also I created an acceptance test named "login"

ember generate acceptance-test login

Which i adjusted to make use of the authenticateSession(); helper:

import Ember from 'ember';
import {
  module,
  test
} from 'qunit';
import startApp from 'project1/tests/helpers/start-app';

var application;

module('Acceptance: Login', {
  beforeEach: function() {
    application = startApp();
  },

  afterEach: function() {
    Ember.run(application, 'destroy');
  }
});

test('visiting /login', function(assert) {
  authenticateSession();
  ok('yes');
});

Now however, whenever i run ember test I get the same error message:

acceptance/login-test.js: line 22, col 3, 'authenticateSession' is not defined.

What did I miss to be not able to access the simple-auth helpers inside my acceptance test? I also tried with the simple-auth 0.7.3 release,... In another try I set up a custom authorizer, but got the same error.




Aucun commentaire:

Enregistrer un commentaire