Skip to content

Instantly share code, notes, and snippets.

@thijsvdanker
Created November 6, 2015 09:57
Show Gist options
  • Save thijsvdanker/891cdf85e1066e69682d to your computer and use it in GitHub Desktop.
Save thijsvdanker/891cdf85e1066e69682d to your computer and use it in GitHub Desktop.
Visiting two routes that require authentication in an acceptance test only redirects once.
import Ember from 'ember';
import { module, test } from 'qunit';
import startApp from 'APP_NAME/tests/helpers/start-app';
module('Acceptance | authenticated routes', {
beforeEach: function() {
this.application = startApp();
},
afterEach: function() {
Ember.run(this.application, 'destroy');
}
});
test('Unauthenticated users can not visit routes that require authentication', function(assert) {
// When I visit a protected route.
visit('/protected-route');
andThen(function() {
// Then I get redirected to the login page.
assert.equal(currentURL(), '/login');
});
// When I visit it again.
visit('/protected-route');
andThen(function() {
// Then I get still get redirected to the login page.
assert.equal(currentURL(), '/login');
});
});
@mtmjansen
Copy link

Hello Thijs,

I found this issue that you submitted
mainmatter/ember-simple-auth#769

Almost a year later I have the same problem:

  • Not being redirected on the second visit to a authenticated route within one qunit test.

Did you resolve this? / What did you do?

gr. Marco

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment