PageRenderTime 4ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/wheels/tests/view/forms/$objectName.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 38 lines | 30 code | 8 blank | 0 comment | 0 complexity | 180a446e029cc6155d1b869b4ca6a20c MD5 | raw file
 1<cfcomponent extends="wheelsMapping.Test">
 2
 3	<cffunction name="setup">
 4		<cfset loc.controller = controller(name="ControllerWithNestedModel")>
 5	</cffunction>
 6
 7	<cffunction name="test_$objectName_with_objectName">
 8		<cfset loc.objectName = loc.controller.$objectName(objectName="author")>
 9		<cfset assert('loc.objectName eq "author"') />
10	</cffunction>
11
12	<cffunction name="test_$objectName_with_objectName_as_struct">
13		<cfset loc.struct = { formField = "formValue" }>
14		<cfset loc.objectName = loc.controller.$objectName(objectName=loc.struct)>
15		<cfset assert('IsStruct(loc.objectName) eq true') />
16	</cffunction>
17
18	<cffunction name="test_$objectName_hasOne_association">
19		<cfset loc.objectName = loc.controller.$objectName(objectName="author", association="profile")>
20		<cfset assert('loc.objectName eq "author[''profile'']"') />
21	</cffunction>
22
23	<cffunction name="test_$objectName_hasMany_association">
24		<cfset loc.objectName = loc.controller.$objectName(objectName="author", association="posts", position="1")>
25		<cfset assert('loc.objectName eq "author[''posts''][1]"') />
26	</cffunction>
27
28	<cffunction name="test_$objectName_hasMany_associations_nested">
29		<cfset loc.objectName = loc.controller.$objectName(objectName="author", association="posts,comments", position="1,2")>
30		<cfset assert('loc.objectName eq "author[''posts''][1][''comments''][2]"') />
31	</cffunction>
32
33	<cffunction name="test_$objectName_raises_error_without_correct_positions">
34		<cfset loc.e = raised('loc.controller.$objectName(objectName="author", association="posts,comments", position="1")')>
35		<cfset assert('loc.e eq "Wheels.InvalidArgument"') />
36	</cffunction>
37
38</cfcomponent>