1

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.

1 Answer 1

2

You need to import the testing helpers like this:

import initializeTestHelpers from 'simple-auth-testing/test-helpers';
initializeTestHelpers();
Sign up to request clarification or add additional context in comments.

1 Comment

and more important the next line in the documentation. It says: "...and add "authenticateSession" and "invalidateSession" to the "predef" section of tests/.jshintrc."

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.