File tree 4 files changed +39
-0
lines changed
src/test/groovy/appgenerator
4 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ class UrlMappings {
7
7
" /validate" (controller : ' generator' , action : ' validate' )
8
8
" /$name (.zip)" (controller : ' generator' , action : ' generateDefault' )
9
9
" /appData" (controller : ' versions' , action : ' appData' )
10
+ " /pluginData" (controller : ' versions' , action : ' pluginData' )
10
11
" /versions" (controller : ' versions' , action : ' grailsVersions' )
11
12
" /$version /profiles" (controller : ' profile' , action : ' profiles' )
12
13
" /$version /$profile /features" (controller : ' profile' , action : ' features' )
Original file line number Diff line number Diff line change @@ -22,4 +22,10 @@ class VersionsController {
22
22
[version : it, profiles : profileService. getProfiles(it)]
23
23
}])
24
24
}
25
+
26
+ def pluginData () {
27
+ respond([pluginData : versionService. supportedVersions. collect {
28
+ [version : it, profiles : profileService. getPluginProfiles(it)]
29
+ }])
30
+ }
25
31
}
Original file line number Diff line number Diff line change
1
+ import groovy.transform.Field
2
+
3
+ @Field List<Map> pluginData
4
+
5
+ json(pluginData) { Map m ->
6
+ version m.version
7
+ profiles tmpl."/profile/profile"(m.profiles)
8
+ }
Original file line number Diff line number Diff line change @@ -52,4 +52,28 @@ class VersionsControllerSpec extends Specification implements ControllerUnitTest
52
52
response. json[1 ]. version == ' b'
53
53
response. json[1 ]. profiles. size() == 1
54
54
}
55
+
56
+ void " test pluginData" () {
57
+ given :
58
+ controller. versionService = Mock (VersionService ) {
59
+ 1 * getSupportedVersions() >> [" a" , " b" ]
60
+ }
61
+ def profile1 = new Profile ()
62
+ def profile2 = new Profile ()
63
+ controller. profileService = Mock (ProfileService ) {
64
+ 1 * getPluginProfiles(" a" ) >> [profile1]
65
+ 1 * getPluginProfiles(" b" ) >> [profile2]
66
+ }
67
+
68
+ when :
69
+ webRequest. actionName = " pluginData"
70
+ controller. pluginData()
71
+ render()
72
+
73
+ then :
74
+ response. json[0 ]. version == ' a'
75
+ response. json[0 ]. profiles. size() == 1
76
+ response. json[1 ]. version == ' b'
77
+ response. json[1 ]. profiles. size() == 1
78
+ }
55
79
}
You can’t perform that action at this time.
0 commit comments