Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit f88c5951
authored
Mar 30, 2011
by
Sascha Depold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
define user globally
1 parent
d6b272bf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
18 deletions
test/Model/find-findAll-all.js
test/Model/sync-drop.js
test/Model/find-findAll-all.js
View file @
f88c595
...
@@ -2,13 +2,10 @@ var assert = require("assert")
...
@@ -2,13 +2,10 @@ var assert = require("assert")
,
config
=
require
(
"./../config"
)
,
config
=
require
(
"./../config"
)
,
Sequelize
=
require
(
"./../../index"
)
,
Sequelize
=
require
(
"./../../index"
)
,
sequelize
=
new
Sequelize
(
config
.
database
,
config
.
username
,
config
.
password
,
{
logging
:
false
})
,
sequelize
=
new
Sequelize
(
config
.
database
,
config
.
username
,
config
.
password
,
{
logging
:
false
})
,
User
=
sequelize
.
define
(
'User'
,
{
name
:
Sequelize
.
STRING
,
bio
:
Sequelize
.
TEXT
})
module
.
exports
=
{
module
.
exports
=
{
'all should return all created models'
:
function
(
beforeExit
)
{
'all should return all created models'
:
function
(
beforeExit
)
{
var
User
=
sequelize
.
define
(
'User'
,
{
name
:
Sequelize
.
STRING
,
bio
:
Sequelize
.
TEXT
})
User
.
sync
({
force
:
true
}).
on
(
'success'
,
function
()
{
User
.
sync
({
force
:
true
}).
on
(
'success'
,
function
()
{
User
.
create
({
name
:
'foo'
,
bio
:
'foobar'
}).
on
(
'success'
,
function
()
{
User
.
create
({
name
:
'foo'
,
bio
:
'foobar'
}).
on
(
'success'
,
function
()
{
User
.
create
({
name
:
'bar'
,
bio
:
'foobar'
}).
on
(
'success'
,
function
()
{
User
.
create
({
name
:
'bar'
,
bio
:
'foobar'
}).
on
(
'success'
,
function
()
{
...
@@ -19,5 +16,8 @@ module.exports = {
...
@@ -19,5 +16,8 @@ module.exports = {
})
})
})
})
})
})
},
'find should return a single model'
:
function
(
beforeExit
)
{
beforeExit
()
}
}
}
}
\ No newline at end of file
test/Model/sync-drop.js
View file @
f88c595
...
@@ -2,28 +2,18 @@ var assert = require("assert")
...
@@ -2,28 +2,18 @@ var assert = require("assert")
,
config
=
require
(
"./../config"
)
,
config
=
require
(
"./../config"
)
,
Sequelize
=
require
(
"./../../index"
)
,
Sequelize
=
require
(
"./../../index"
)
,
sequelize
=
new
Sequelize
(
config
.
database
,
config
.
username
,
config
.
password
,
{
logging
:
false
})
,
sequelize
=
new
Sequelize
(
config
.
database
,
config
.
username
,
config
.
password
,
{
logging
:
false
})
,
User
=
sequelize
.
define
(
'User'
,
{
name
:
Sequelize
.
STRING
,
bio
:
Sequelize
.
TEXT
})
module
.
exports
=
{
module
.
exports
=
{
'sync should work with correct database config'
:
function
(
beforeExit
)
{
'sync should work with correct database config'
:
function
(
beforeExit
)
{
var
User
=
sequelize
.
define
(
'User'
,
{
name
:
Sequelize
.
STRING
,
bio
:
Sequelize
.
TEXT
})
User
.
sync
().
on
(
'success'
,
beforeExit
)
User
.
sync
().
on
(
'success'
,
beforeExit
)
},
},
'sync should fail with incorrect database config'
:
function
(
beforeExit
)
{
'sync should fail with incorrect database config'
:
function
(
beforeExit
)
{
var
s
=
new
Sequelize
(
'foo'
,
'bar'
,
null
,
{
logging
:
false
})
var
s
=
new
Sequelize
(
'foo'
,
'bar'
,
null
,
{
logging
:
false
})
var
User
=
s
.
define
(
'User'
,
{
var
User2
=
s
.
define
(
'User'
,
{
name
:
Sequelize
.
STRING
,
bio
:
Sequelize
.
TEXT
})
name
:
Sequelize
.
STRING
,
User2
.
sync
().
on
(
'failure'
,
beforeExit
)
bio
:
Sequelize
.
TEXT
})
User
.
sync
().
on
(
'failure'
,
beforeExit
)
},
},
'drop should work'
:
function
(
beforeExit
)
{
'drop should work'
:
function
(
beforeExit
)
{
var
User
=
sequelize
.
define
(
'User'
,
{
name
:
Sequelize
.
STRING
,
bio
:
Sequelize
.
TEXT
})
User
.
drop
().
on
(
'success'
,
beforeExit
)
User
.
drop
().
on
(
'success'
,
beforeExit
)
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment