Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,12 @@ var genUser = function() {
};

describe('User Model', function() {
before(function() {
// Clear users before testing
return User.removeAsync();
});
// Clear users before testing
before(User.removeAsync);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@deltreey my apologies, I should have mentioned that the User methods will lose context to their parent object, so they'll need to be bound like: User.removeAsync.bind(User)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Babel supports ::User.removeAsync too, right?


beforeEach(function() {
genUser();
});
beforeEach(genUser);

afterEach(function() {
return User.removeAsync();
});
afterEach(User.removeAsync);

it('should begin with no users', function() {
return User.findAsync({})
Expand All @@ -48,9 +42,7 @@ describe('User Model', function() {
});

describe('#password', function() {
beforeEach(function() {
return user.saveAsync();
});
beforeEach(user.saveAsync);

it('should authenticate user if valid', function() {
user.authenticate('password').should.be.true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ describe('User Model', function() {
});
});

beforeEach(function() {
genUser();
});
beforeEach(genUser);

afterEach(function() {
return User.destroy({ where: {} });
Expand All @@ -50,9 +48,7 @@ describe('User Model', function() {
});

describe('#password', function() {
beforeEach(function() {
return user.save();
});
beforeEach(user.save);

it('should authenticate user if valid', function() {
user.authenticate('password').should.be.true;
Expand Down