PageRenderTime 8ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

/wheels/tests/model/validations/low_level_validations.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 21 lines | 18 code | 3 blank | 0 comment | 0 complexity | 110a8514c23e180a180a7990d1208ab4 MD5 | raw file
 1<cfcomponent extends="wheelsMapping.Test">
 2
 3	<cffunction name="test_validate_and_validateOnCreate_should_be_called_when_creating">
 4		<cfset loc.user = model("user").new()>
 5		<cfset loc.user.valid()>
 6		<cfset assert('StructKeyExists(loc.user, "_validateCalled")')>
 7		<cfset assert('loc.user._validateCalled eq true')>
 8		<cfset assert('StructKeyExists(loc.user, "_validateOnCreateCalled")')>
 9		<cfset assert('loc.user._validateOnCreateCalled eq true')>
10	</cffunction>
11	
12	<cffunction name="test_validate_and_validateOnUpdate_should_be_called_when_updating">
13		<cfset loc.user = model("user").findOne(where="username = 'perd'")>
14		<cfset loc.user.valid()>
15		<cfset assert('StructKeyExists(loc.user, "_validateCalled")')>
16		<cfset assert('loc.user._validateCalled eq true')>
17		<cfset assert('StructKeyExists(loc.user, "_validateOnUpdateCalled")')>
18		<cfset assert('loc.user._validateOnUpdateCalled eq true')>
19	</cffunction>
20
21</cfcomponent>