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
不要怂,就是干,撸起袖子干!
You need to sign in or sign up before continuing.
Commit 99a6d3c5
authored
Feb 15, 2013
by
Sascha Depold
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #432 from clkao/patch-3
get dialect from env when not specified
2 parents
e24091f2
82cabc6c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
6 deletions
spec/migrator.spec.js
spec/sequelize.spec.js
spec/migrator.spec.js
View file @
99a6d3c
...
...
@@ -28,7 +28,7 @@ describe(Helpers.getTestDialectTeaser("Migrator"), function() {
.
error
(
function
(
err
)
{
console
.
log
(
err
)
})
}.
bind
(
this
)
Helpers
.
initTests
({
onComplete
:
done
,
context
:
this
})
Helpers
.
initTests
({
dialect
:
dialect
,
onComplete
:
done
,
context
:
this
})
})
it
(
"as"
,
function
()
{
...
...
spec/sequelize.spec.js
View file @
99a6d3c
...
...
@@ -5,11 +5,18 @@ if(typeof require === 'function') {
}
var
qq
=
function
(
str
)
{
if
(
dialect
==
'postgres'
)
return
'"'
+
str
+
'"'
;
return
str
;
};
buster
.
spec
.
expose
()
describe
(
Helpers
.
getTestDialectTeaser
(
"Sequelize"
),
function
()
{
before
(
function
(
done
)
{
Helpers
.
initTests
({
dialect
:
dialect
,
beforeComplete
:
function
(
sequelize
)
{
this
.
sequelize
=
sequelize
}.
bind
(
this
),
onComplete
:
done
})
...
...
@@ -34,7 +41,7 @@ describe(Helpers.getTestDialectTeaser("Sequelize"), function() {
username
:
Helpers
.
Sequelize
.
STRING
})
this
.
insertQuery
=
"INSERT INTO "
+
this
.
User
.
tableName
+
" (username, createdAt, updatedAt
) VALUES ('john', '2012-01-01 10:10:10', '2012-01-01 10:10:10')"
this
.
insertQuery
=
"INSERT INTO "
+
qq
(
this
.
User
.
tableName
)
+
" (username, "
+
qq
(
"createdAt"
)
+
", "
+
qq
(
"updatedAt"
)
+
"
) VALUES ('john', '2012-01-01 10:10:10', '2012-01-01 10:10:10')"
this
.
User
.
sync
().
success
(
done
).
error
(
function
(
err
)
{
console
(
err
)
...
...
@@ -69,7 +76,7 @@ describe(Helpers.getTestDialectTeaser("Sequelize"), function() {
it
(
'executes select queries correctly'
,
function
(
done
)
{
this
.
sequelize
.
query
(
this
.
insertQuery
).
success
(
function
()
{
this
.
sequelize
.
query
(
"select * from "
+
this
.
User
.
tableName
)
.
query
(
"select * from "
+
qq
(
this
.
User
.
tableName
)
+
""
)
.
success
(
function
(
users
)
{
expect
(
users
.
map
(
function
(
u
){
return
u
.
username
})).
toEqual
([
'john'
])
done
()
...
...
@@ -82,7 +89,8 @@ describe(Helpers.getTestDialectTeaser("Sequelize"), function() {
}.
bind
(
this
))
})
it
(
'executes stored procedures'
,
function
(
done
)
{
if
(
dialect
==
'mysql'
)
it
(
'executes stored procedures'
,
function
(
done
)
{
this
.
sequelize
.
query
(
this
.
insertQuery
).
success
(
function
()
{
this
.
sequelize
.
query
(
'DROP PROCEDURE IF EXISTS foo'
).
success
(
function
()
{
this
.
sequelize
.
query
(
...
...
@@ -95,11 +103,11 @@ describe(Helpers.getTestDialectTeaser("Sequelize"), function() {
}.
bind
(
this
))
}.
bind
(
this
))
}.
bind
(
this
))
})
})
it
(
'uses the passed DAOFactory'
,
function
(
done
)
{
this
.
sequelize
.
query
(
this
.
insertQuery
).
success
(
function
()
{
this
.
sequelize
.
query
(
"SELECT * FROM "
+
this
.
User
.
tableName
+
";"
,
this
.
User
).
success
(
function
(
users
)
{
this
.
sequelize
.
query
(
"SELECT * FROM "
+
qq
(
this
.
User
.
tableName
)
+
";"
,
this
.
User
).
success
(
function
(
users
)
{
expect
(
users
[
0
].
__factory
).
toEqual
(
this
.
User
)
done
()
}.
bind
(
this
))
...
...
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