|
| 1 | +/* |
| 2 | + * Copyright © 2017 Atomist, Inc. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +scenario ConvertExistingProjectToGenerator should add Rug archive files and default generator |
| 18 | + |
| 19 | +let archive_name = "my-rug-archive" |
| 20 | +let group_id = "my-rug-group" |
| 21 | +let version = "0.0.1" |
| 22 | +let manifest = ".atomist/manifest.yml" |
| 23 | +let generator_name = "MyNewGenerator" |
| 24 | +let description = "Description of MyNewGenerator" |
| 25 | + |
| 26 | +given |
| 27 | + Empty |
| 28 | + |
| 29 | +when |
| 30 | + ConvertExistingProjectToGenerator |
| 31 | + |
| 32 | +then |
| 33 | + fileExists manifest |
| 34 | + and fileContains manifest { 'artifact: "' + archive_name + '"' } |
| 35 | + and fileContains manifest { 'group: "' + group_id + '"' } |
| 36 | + and fileContains manifest version |
| 37 | + and fileExists ".atomist/package.json" |
| 38 | + and fileContains ".atomist/package.json" '"@atomist/rug"' |
| 39 | + and fileContains ".atomist/package.json" '"0.12.0"' |
| 40 | + and fileExists ".atomist/tsconfig.json" |
| 41 | + and fileContains ".atomist/tsconfig.json" "suppressImplicitAnyIndexErrors" |
| 42 | + and fileExists ".atomist/.gitignore" |
| 43 | + and fileContains ".atomist/.gitignore" "node_modules" |
| 44 | + and directoryExists ".atomist/node_modules/@atomist/rug" |
| 45 | + and fileExists ".atomist/node_modules/@atomist/rug/model/Core.ts" |
| 46 | + and fileExists ".atomist/editors/MyNewGenerator.ts" |
| 47 | + and fileContains ".atomist/editors/MyNewGenerator.ts" '@Generator("MyNewGenerator"' |
| 48 | + and fileContains ".atomist/editors/MyNewGenerator.ts" "class MyNewGenerator" |
| 49 | + and fileContains ".atomist/editors/MyNewGenerator.ts" "new MyNewGenerator()" |
| 50 | + and { !result.fileContains(".atomist/editors/MyNewGenerator.ts", "TypeScriptGenerator") } |
| 51 | + and { !result.fileContains(".atomist/editors/MyNewGenerator.ts", "@DESCRIPTION@") } |
| 52 | + and { !result.fileContains(".atomist/editors/MyNewGenerator.ts", "typeScriptGenerator") } |
| 53 | + and fileExists ".atomist/tests/MyNewGenerator.rt" |
| 54 | + and fileContains ".atomist/tests/MyNewGenerator.rt" "scenario MyNewGenerator" |
| 55 | + and { !result.fileContains(".atomist/tests/MyNewGenerator.rt", "TypeScriptGenerator") } |
| 56 | + |
| 57 | + |
| 58 | +scenario ConvertExistingProjectToGenerator should add appropriate generator tests assertions |
| 59 | + |
| 60 | +let archive_name = "my-rug-archive" |
| 61 | +let group_id = "my-rug-group" |
| 62 | +let version = "0.0.1" |
| 63 | +let manifest = ".atomist/manifest.yml" |
| 64 | +let generator_name = "MyNewGenerator" |
| 65 | +let description = "Description of MyNewGenerator" |
| 66 | + |
| 67 | +given |
| 68 | + "README.md" = "Beulah" |
| 69 | + "CHANGELOG.md" = "Handsome Western States" |
| 70 | + "LICENSE" = "When Your Heartstrings Break" |
| 71 | + "configure" = "The Coast Is Never Clear" |
| 72 | + |
| 73 | +when |
| 74 | + ConvertExistingProjectToGenerator |
| 75 | + |
| 76 | +then |
| 77 | + fileExists manifest |
| 78 | + and fileContains manifest { 'artifact: "' + archive_name + '"' } |
| 79 | + and fileContains manifest { 'group: "' + group_id + '"' } |
| 80 | + and fileContains manifest version |
| 81 | + and fileExists ".atomist/package.json" |
| 82 | + and fileContains ".atomist/package.json" '"@atomist/rug"' |
| 83 | + and fileContains ".atomist/package.json" '"0.12.0"' |
| 84 | + and fileExists ".atomist/tsconfig.json" |
| 85 | + and fileContains ".atomist/tsconfig.json" "suppressImplicitAnyIndexErrors" |
| 86 | + and fileExists ".atomist/.gitignore" |
| 87 | + and fileContains ".atomist/.gitignore" "node_modules" |
| 88 | + and directoryExists ".atomist/node_modules/@atomist/rug" |
| 89 | + and fileExists ".atomist/node_modules/@atomist/rug/model/Core.ts" |
| 90 | + and fileExists ".atomist/editors/MyNewGenerator.ts" |
| 91 | + and fileContains ".atomist/editors/MyNewGenerator.ts" '@Generator("MyNewGenerator"' |
| 92 | + and fileContains ".atomist/editors/MyNewGenerator.ts" "class MyNewGenerator" |
| 93 | + and fileContains ".atomist/editors/MyNewGenerator.ts" "new MyNewGenerator()" |
| 94 | + and { !result.fileContains(".atomist/editors/MyNewGenerator.ts", "TypeScriptGenerator") } |
| 95 | + and { !result.fileContains(".atomist/editors/MyNewGenerator.ts", "@DESCRIPTION@") } |
| 96 | + and { !result.fileContains(".atomist/editors/MyNewGenerator.ts", "typeScriptGenerator") } |
| 97 | + and fileExists ".atomist/tests/MyNewGenerator.rt" |
| 98 | + and fileContains ".atomist/tests/MyNewGenerator.rt" "scenario MyNewGenerator" |
| 99 | + and { !result.fileContains(".atomist/tests/MyNewGenerator.rt", "TypeScriptGenerator") } |
| 100 | + and fileContains ".atomist/tests/MyNewGenerator.rt" 'fileExists "README.md"' |
| 101 | + and fileContains ".atomist/tests/MyNewGenerator.rt" 'fileExists "CHANGELOG.md"' |
| 102 | + and fileContains ".atomist/tests/MyNewGenerator.rt" 'fileExists "LICENSE"' |
| 103 | + and fileContains ".atomist/tests/MyNewGenerator.rt" 'fileExists "configure"' |
| 104 | + |
| 105 | + |
| 106 | +scenario ConvertExistingProjectToGenerator should make no change if project already contains a manifest |
| 107 | + |
| 108 | +let archive_name = "my-rug-archive" |
| 109 | +let group_id = "my-rug-group" |
| 110 | +let version = "0.0.1" |
| 111 | +let generator_name = "MyNewGenerator" |
| 112 | +let description = "Description of MyNewGenerator" |
| 113 | + |
| 114 | +given |
| 115 | + ArchiveRoot |
| 116 | + |
| 117 | +when |
| 118 | + ConvertExistingProjectToGenerator |
| 119 | + |
| 120 | +then |
| 121 | + NoChange |
0 commit comments