-
Notifications
You must be signed in to change notification settings - Fork 40
/
MongoBlogTest.cfc
48 lines (33 loc) · 944 Bytes
/
MongoBlogTest.cfc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<cfcomponent output="false" extends="mxunit.framework.TestCase">
<cfscript>
mongo = createObject('component', 'MongoDB');
blog = createObject('component', 'Blog');
blog.title = 'Title 1';
blog.text = 'Text 1';
blog.author = 'bill-1';
mongo.put(blog);
blog.title = 'Title 2';
blog.text = 'Text 2';
blog.author = 'bill-2';
mongo.put(blog);
blog.title = 'Title 3';
blog.text = 'Text 3';
blog.author = 'bill-3';
mongo.put(blog);
/* weird. setUp appears to not be called in Railo? */
function _tearDown(){
items = mongo.findAll();
for(i=1; i<=arrayLen(items);i++){
o = items[i];
mongo.deleteById( o['_id'].toString() );
debug( o['_id'].toString() );
}
}
function testFindIterator(){
items = mongo.findAll();
assertEquals(3,items.size());
}
function setUp(){
}
</cfscript>
</cfcomponent>