This repository has been archived by the owner on Nov 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #157 from int128/issue-135
Fix resolveSwaggerTemplate fails if multiple JARs are given
- Loading branch information
Showing
4 changed files
with
67 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/test/groovy/org/hidetake/gradle/swagger/generator/ResolveSwaggerTemplateSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package org.hidetake.gradle.swagger.generator | ||
|
||
import org.junit.Rule | ||
import org.junit.rules.TemporaryFolder | ||
import spock.lang.Specification | ||
|
||
class ResolveSwaggerTemplateSpec extends Specification { | ||
|
||
@Rule | ||
TemporaryFolder temporaryFolder = new TemporaryFolder() | ||
|
||
def 'task should expand JARs into build/swagger-template'() { | ||
given: | ||
def repositoryFolder = temporaryFolder.newFolder() | ||
Fixture.createJAR(new File(repositoryFolder, 'template-foo-1.0.0.jar'), [ | ||
'foo.txt': 'foo-hello-world', | ||
]) | ||
Fixture.createJAR(new File(repositoryFolder, 'template-bar-1.0.0.jar'), [ | ||
'bar.txt': 'bar-hello-world', | ||
]) | ||
|
||
def project = Fixture.projectWithPlugin { | ||
repositories { | ||
flatDir { | ||
dirs repositoryFolder | ||
} | ||
} | ||
dependencies { | ||
swaggerTemplate 'com.example:template-foo:1.0.0' | ||
swaggerTemplate 'com.example:template-bar:1.0.0' | ||
} | ||
} | ||
|
||
when: | ||
project.tasks.resolveSwaggerTemplate.copy() | ||
|
||
then: | ||
project.file('build/swagger-template/foo.txt').text == 'foo-hello-world' | ||
project.file('build/swagger-template/bar.txt').text == 'bar-hello-world' | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters