Fixing the tests for Windows

This commit is contained in:
Marcin Grzejszczak
2016-10-10 14:09:02 +02:00
parent fa152252b9
commit 118dd8e04f

View File

@@ -9,11 +9,12 @@ class ContractDownloaderSpec extends Specification {
StubDownloader stubDownloader = Stub()
StubConfiguration stubConfiguration = new StubConfiguration('')
File file = new File('/some/path/to/somewhere')
File file = new File(File.separator + ['some','path','to','somewhere'].join(File.separator))
def 'should set inclusion pattern on config when path pattern was explicitly provided with a separator at the beginning'() {
given:
String contractPath = '/a/b/c/d'
String contractPath = File.separator + ['a','b','c','d'].join(File.separator)
ContractDownloader contractDownloader = new ContractDownloader(stubDownloader,
stubConfiguration, contractPath, '', '')
ContractVerifierConfigProperties properties = new ContractVerifierConfigProperties()
@@ -22,12 +23,13 @@ class ContractDownloaderSpec extends Specification {
when:
contractDownloader.unpackedDownloadedContracts(properties)
then:
properties.includedContracts == '^/some/path/to/somewhere/a/b/c/d.*$'
properties.includedContracts == fileSeparated('^/some/path/to/somewhere/a/b/c/d.*$')
}
def 'should set inclusion pattern on config when path pattern was explicitly provided without a separator at the beginning'() {
given:
String contractPath = 'a/b/c/d'
String contractPath = fileSeparated('a/b/c/d')
ContractDownloader contractDownloader = new ContractDownloader(stubDownloader,
stubConfiguration, contractPath, '', '')
ContractVerifierConfigProperties properties = new ContractVerifierConfigProperties()
@@ -36,6 +38,10 @@ class ContractDownloaderSpec extends Specification {
when:
contractDownloader.unpackedDownloadedContracts(properties)
then:
properties.includedContracts == '^/some/path/to/somewhere/a/b/c/d.*$'
properties.includedContracts == fileSeparated('^/some/path/to/somewhere/a/b/c/d.*$')
}
private static String fileSeparated(String string) {
return string.replace('/', File.separator)
}
}