不要怂,就是干,撸起袖子干!

Commit 81a2e3cc by Daniel Durante

Added one more test spec as well as checking for access_level in one of the spec…

…s to make sure that we're getting the right information back.
1 parent 479cfdea
Showing with 11 additions and 0 deletions
...@@ -2073,12 +2073,23 @@ describe(Helpers.getTestDialectTeaser("DAOFactory"), function() { ...@@ -2073,12 +2073,23 @@ describe(Helpers.getTestDialectTeaser("DAOFactory"), function() {
this.ScopeMe.findAll().success(function(users) { this.ScopeMe.findAll().success(function(users) {
expect(users).toBeArray() expect(users).toBeArray()
expect(users.length).toEqual(2) expect(users.length).toEqual(2)
expect([10,5].indexOf(users[0].access_level) !== -1).toBeTrue()
expect([10,5].indexOf(users[1].access_level) !== -1).toBeTrue()
expect(['dan', 'tobi'].indexOf(users[0].username) !== -1).toBeTrue() expect(['dan', 'tobi'].indexOf(users[0].username) !== -1).toBeTrue()
expect(['dan', 'tobi'].indexOf(users[1].username) !== -1).toBeTrue() expect(['dan', 'tobi'].indexOf(users[1].username) !== -1).toBeTrue()
done() done()
}) })
}) })
it("should be able to amend the default scope with a find object", function(done) {
this.ScopeMe.findAll({where: {username: 'dan'}}).success(function(users) {
expect(users).toBeArray()
expect(users.length).toEqual(1)
expect(users[0].username).toEqual('dan')
done()
})
})
it("should be able to override the default scope", function(done) { it("should be able to override the default scope", function(done) {
this.ScopeMe.scope('fakeEmail').findAll().success(function(users) { this.ScopeMe.scope('fakeEmail').findAll().success(function(users) {
expect(users).toBeArray() expect(users).toBeArray()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!