Skip to content

Commit

Permalink
Update getDomain method in ProviderConfig to support local repositori…
Browse files Browse the repository at this point in the history
…es - #1492

Signed-off-by: Emilio Palumbo <emiliopalumbo@gmail.com>
  • Loading branch information
emi80 committed Jun 9, 2020
1 parent 28e8c5a commit bcec488
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ class ProviderConfig {
if( p != -1 )
result = result.substring(p+3)
p = result.indexOf('/')
if( p != -1 )
result = result.substring(0,p)
if( p > 0 )
result = result.substring(0, p)
return result
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,25 @@ class ProviderConfigTest extends Specification {
def 'should return provider attributes' () {

when:
def config = new ProviderConfig('custom',[platform: 'github', server:'http://local.host'])
def config = new ProviderConfig('local',[platform: 'file', path:'/local/repo'])
then:
config.name == 'local'
config.platform == 'file'
config.domain == '/local/repo'
config.server == null
config.endpoint == null

when:
config = new ProviderConfig('local',[platform: 'file', path:'file:///local/repo'])
then:
config.name == 'local'
config.platform == 'file'
config.domain == '/local/repo'
config.server == null
config.endpoint == null

when:
config = new ProviderConfig('custom',[platform: 'github', server:'http://local.host'])
then:
config.name == 'custom'
config.platform == 'github'
Expand Down

0 comments on commit bcec488

Please sign in to comment.