Skip to content

Commit

Permalink
Added profile support unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-vieira committed Dec 8, 2014
1 parent 5ab8639 commit 654ff63
Showing 1 changed file with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package net.linguica.gradle.maven.settings

import org.gradle.mvn3.org.apache.maven.settings.Mirror
import org.gradle.mvn3.org.apache.maven.settings.Profile
import org.junit.Test

import static org.junit.Assert.*
Expand Down Expand Up @@ -163,4 +164,43 @@ class MavenSettingsPluginTest extends AbstractMavenSettingsTest {
assertThat(project.repositories, hasItem(hasProperty('name', equalTo('MavenLocal'))))
assertThat(project.repositories, hasItem(hasProperty('name', equalTo('myRemote'))))
}

@Test
void profileActiveWithSettingsActiveProfile() {
def props = new Properties()
props.setProperty('myprop', 'true')

withSettings {
profiles.add new Profile(id: 'myprofile', properties: props)
activeProfiles = ['myprofile']
}

addPluginWithSettings(project)

project.evaluate()

assertThat(project.properties, hasEntry('myprop', 'true'))
}

@Test
void profileActiveWithExtensionActiveProfile() {
def props = new Properties()
props.setProperty('myprop', 'true')

withSettings {
profiles.add new Profile(id: 'myprofile', properties: props)
}

addPluginWithSettings(project)

project.with {
mavenSettings {
activeProfiles = ['myprofile']
}
}

project.evaluate()

assertThat(project.properties, hasEntry('myprop', 'true'))
}
}

0 comments on commit 654ff63

Please sign in to comment.