File tree Expand file tree Collapse file tree 4 files changed +17
-6
lines changed
activeweb-testing/src/test
activeweb/src/main/java/org/javalite/activeweb Expand file tree Collapse file tree 4 files changed +17
-6
lines changed Original file line number Diff line number Diff line change 22
22
* @author Igor Polevoy
23
23
*/
24
24
public class ActiveWebParamsController extends AppController {
25
- public void index (){}
25
+ public void index (){
26
+ appContext ().set ("name" , "javalight" );
27
+ }
26
28
}
Original file line number Diff line number Diff line change @@ -33,14 +33,17 @@ public void before(){
33
33
}
34
34
35
35
@ Test
36
- public void shouldAssignAWMapToView (){
36
+ public void shouldDisplayBuiltInValues (){
37
37
38
38
request ().get ("index" );
39
39
String response = responseContent ();
40
40
41
- a (response .contains ("restful = false" )).shouldBeTrue ();
42
- a (response .contains ("action = index" )).shouldBeTrue ();
43
- a (response .contains ("controller = /active_web_params" )).shouldBeTrue ();
44
- a (response .contains ("environment = " + AppConfig .activeEnv ())).shouldBeTrue ();
41
+ the (response ).shouldContain ("restful = false" );
42
+ the (response ).shouldContain ("action = index" );
43
+ the (response ).shouldContain ("controller = /active_web_params" );
44
+ the (response ).shouldContain ("environment = " + AppConfig .activeEnv ());
45
+ the (response ).shouldContain ("Context path: /test_context" );
46
+ the (response ).shouldContain ("AppContext: org.javalite.activeweb.AppContext" );
47
+ the (response ).shouldContain ("AppContext Value: javalight" );
45
48
}
46
49
}
Original file line number Diff line number Diff line change 1
1
<#list activeweb?keys as key >
2
2
${key} = ${activeweb[key]?string }
3
3
</#list >
4
+ Context path: ${context_path}
5
+ AppContext: ${app_context}
6
+ AppContext Value: ${app_context.name}
4
7
Original file line number Diff line number Diff line change @@ -52,6 +52,9 @@ private static void insertActiveWebParamsInto(Map assigns) {
52
52
params .put ("action" , RequestContext .getRoute ().getActionName ());
53
53
params .put ("restful" , RequestContext .getRoute ().getController ().restful ());
54
54
}
55
+
56
+ assigns .put ("app_context" , RequestContext .getAppContext ());
57
+
55
58
assigns .put ("activeweb" , params );
56
59
}
57
60
You can’t perform that action at this time.
0 commit comments