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

/tests/tests/TestRepresentations.cfc

http://github.com/atuttle/Taffy
ColdFusion CFScript | 40 lines | 33 code | 5 blank | 2 comment | 0 complexity | c2995a8a17194de52fe03b04ca47fb6a MD5 | raw file
 1<cfcomponent extends="base">
 2	<cfscript>
 3	function setup(){
 4		variables.serializer = createObject("component", "taffy.core.baseSerializer");
 5	}
 6
 7	function test_setData_getData(){
 8		variables.serializer.setData(10);
 9		assertEquals(10, variables.serializer.getData());
10	}
11
12	function test_noData_returns_empty_rep_obj(){
13		local.result = variables.serializer.noData();
14		local.meta = getMetaData(local.result);
15		// debug(local.meta);
16		// debug(local.result.getData());
17		assertEquals('taffy.core.baseSerializer', local.meta.fullname);
18		assertEquals("", local.result.getData());
19	}
20
21	function test_withStatus_getStatus(){
22		variables.serializer.withStatus(42);
23		assertEquals(42, variables.serializer.getStatus());
24	}
25
26	function test_withStatus_getStatusText(){
27		variables.serializer.withStatus(404, "Not Found");
28		assertEquals("Not Found", variables.serializer.getStatusText());
29		variables.serializer.withStatus(418);
30		assertEquals("I'm a teapot", variables.serializer.getStatusText());
31	}
32
33	function test_withHeaders_getHeaders(){
34		local.h = {};
35		local.h['x-dude'] = 'dude!';
36		variables.serializer.withHeaders(local.h);
37		assertEquals(true, structKeyExists(variables.serializer.getHeaders(), "x-dude"));
38	}
39	</cfscript>
40</cfcomponent>