parent
dfe2c9cd74
commit
5ba3b125e8
7 changed files with 90 additions and 15 deletions
|
@ -6,10 +6,10 @@ import { authenticateSession } from '../helpers/ember-simple-auth';
|
|||
module('Acceptance | characteristics', {
|
||||
beforeEach: function() {
|
||||
this.application = startApp();
|
||||
server.create('users', { role: 'A', canEdit: true, sub: 1 });
|
||||
authenticateSession(this.application, {
|
||||
access_token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJiYWN0ZGIiLCJzdWIiOiIxIiwiZXhwIjoxNDQ2NTAyMjI2LCJpYXQiOjE0NDY0OTg2MjZ9.vIjKHAsp2TkCV505EbtCo2xQT-2oQkB-Nv5y0b6E7Mg"
|
||||
});
|
||||
server.create('users', { role: 'A', canEdit: true });
|
||||
},
|
||||
|
||||
afterEach: function() {
|
||||
|
@ -70,3 +70,22 @@ test('creating /characteristics/new', function(assert) {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('deleting /characteristics/:id', function(assert) {
|
||||
const characteristic = server.create('characteristics', { 'canEdit': true });
|
||||
visit(`/characteristics/${characteristic.id}`);
|
||||
|
||||
andThen(function() {
|
||||
assert.equal(currentURL(), `/characteristics/${characteristic.id}`);
|
||||
click('button.delete');
|
||||
|
||||
andThen(function() {
|
||||
click('button.delete-confirm');
|
||||
|
||||
andThen(function() {
|
||||
assert.equal(currentURL(), `/characteristics`);
|
||||
assert.equal(server.db.characteristics.length, 0);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -6,10 +6,10 @@ import { authenticateSession } from '../helpers/ember-simple-auth';
|
|||
module('Acceptance | species', {
|
||||
beforeEach: function() {
|
||||
this.application = startApp();
|
||||
server.create('users', { role: 'A', canEdit: true, sub: 1 });
|
||||
authenticateSession(this.application, {
|
||||
access_token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJiYWN0ZGIiLCJzdWIiOiIxIiwiZXhwIjoxNDQ2NTAyMjI2LCJpYXQiOjE0NDY0OTg2MjZ9.vIjKHAsp2TkCV505EbtCo2xQT-2oQkB-Nv5y0b6E7Mg"
|
||||
});
|
||||
server.create('users', { role: 'A', canEdit: true });
|
||||
},
|
||||
|
||||
afterEach: function() {
|
||||
|
@ -69,3 +69,22 @@ test('creating /species/new', function(assert) {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('deleting /species/:id', function(assert) {
|
||||
const species = server.create('species', { 'canEdit': true });
|
||||
visit(`/species/${species.id}`);
|
||||
|
||||
andThen(function() {
|
||||
assert.equal(currentURL(), `/species/${species.id}`);
|
||||
click('button.delete');
|
||||
|
||||
andThen(function() {
|
||||
click('button.delete-confirm');
|
||||
|
||||
andThen(function() {
|
||||
assert.equal(currentURL(), `/species`);
|
||||
assert.equal(server.db.species.length, 0);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -6,10 +6,10 @@ import { authenticateSession } from '../helpers/ember-simple-auth';
|
|||
module('Acceptance | strains', {
|
||||
beforeEach: function() {
|
||||
this.application = startApp();
|
||||
server.create('users', { role: 'A', canEdit: true, sub: 1 });
|
||||
authenticateSession(this.application, {
|
||||
access_token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJiYWN0ZGIiLCJzdWIiOiIxIiwiZXhwIjoxNDQ2NTAyMjI2LCJpYXQiOjE0NDY0OTg2MjZ9.vIjKHAsp2TkCV505EbtCo2xQT-2oQkB-Nv5y0b6E7Mg"
|
||||
});
|
||||
server.create('users', { role: 'A', canEdit: true });
|
||||
},
|
||||
|
||||
afterEach: function() {
|
||||
|
@ -74,3 +74,23 @@ test('creating /strains/new', function(assert) {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('deleting /strains/:id', function(assert) {
|
||||
const species = server.create('species');
|
||||
const strain = server.create('strains', { canEdit: true , species: species.id });
|
||||
visit(`/strains/${strain.id}`);
|
||||
|
||||
andThen(function() {
|
||||
assert.equal(currentURL(), `/strains/${strain.id}`);
|
||||
click('button.delete');
|
||||
|
||||
andThen(function() {
|
||||
click('button.delete-confirm');
|
||||
|
||||
andThen(function() {
|
||||
assert.equal(currentURL(), `/strains`);
|
||||
assert.equal(server.db.strains.length, 0);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -6,10 +6,10 @@ import { invalidateSession, authenticateSession } from '../helpers/ember-simple-
|
|||
module('Acceptance | users', {
|
||||
beforeEach: function() {
|
||||
this.application = startApp();
|
||||
server.create('users', { role: 'A', canEdit: true, sub: 1 });
|
||||
authenticateSession(this.application, {
|
||||
access_token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJiYWN0ZGIiLCJzdWIiOiIxIiwiZXhwIjoxNDQ2NTAyMjI2LCJpYXQiOjE0NDY0OTg2MjZ9.vIjKHAsp2TkCV505EbtCo2xQT-2oQkB-Nv5y0b6E7Mg"
|
||||
});
|
||||
server.create('users', { role: 'A', canEdit: true });
|
||||
},
|
||||
|
||||
afterEach: function() {
|
||||
|
|
Reference in a new issue