PageRenderTime 444ms CodeModel.GetById 201ms app.highlight 1ms RepoModel.GetById 241ms app.codeStats 0ms

/wheels/tests/global/urlfor.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 30 lines | 25 code | 5 blank | 0 comment | 0 complexity | 37e1bbfd7479fe1eb3a9aeedecc2ad90 MD5 | raw file
 1<cfcomponent extends="wheelsMapping.Test">
 2
 3	<cffunction name="setup">
 4		<cfset loc.original_routes = duplicate(application.wheels.routes)>
 5		<cfset loc.original_rewrite = application.wheels.URLRewriting>
 6		<cfset application.wheels.URLRewriting = "On">
 7	</cffunction>
 8
 9	<cffunction name="teardown">
10		<cfset application.wheels.routes = loc.original_routes>
11		<cfset application.wheels.URLRewriting = loc.original_rewrite>
12	</cffunction>
13
14	<cffunction name="test_links_are_properly_hyphenated">
15		<cfset addRoute(name="user_2", pattern="user/[user_id]/[controller]/[action]")>
16		<cfset $setNamedRoutePositions()>
17		<cfset loc.e = "/user/5559/survey-templates/index">
18		<cfset loc.r = urlFor(route="user_2", user_id="5559", controller="SurveyTemplates", action="index")>
19		<cfset assert('loc.r contains loc.e')>
20	</cffunction>
21
22	<cffunction name="test_format_properly_add_with_route">
23		<cfset addRoute(name="user_2", pattern="user/[user_id]/[controller]/[action].[format]")>
24		<cfset $setNamedRoutePositions()>
25		<cfset loc.e = "/user/5559/survey-templates/index.csv">
26		<cfset loc.r = urlFor(route="user_2", user_id="5559", controller="SurveyTemplates", action="index", format="csv")>
27		<cfset assert('loc.r contains loc.e')>
28	</cffunction>
29
30</cfcomponent>