add tags for rspec via system properties

This commit is contained in:
Christian Meier 2015-07-22 18:23:06 +02:00
parent 5ff567efb6
commit 41abec8cb9
2 changed files with 20 additions and 0 deletions

View File

@ -61,10 +61,17 @@ class RSpec extends DefaultTask {
if (pattern != null) {
args += ['--pattern', pattern]
}
String tags = System.getProperty("${name}.tags")
if (tags != null) {
tags.split(/\s+/).each { args += ['--tags', it] }
}
String file = System.getProperty("${name}.file")
if (file != null) {
args += [file]
}
jruby.exec(args)
}
}

View File

@ -286,4 +286,17 @@ class JRubyRSpecPluginSpec extends Specification {
then:
thrown(ExecException)
}
def "Run rspec with unknown tag"() {
given:
Files.createSymbolicLink(specDir.toPath(), new File('src/test/resources/simple/spec').getAbsoluteFile().toPath())
project.evaluate()
System.setProperty('rspec.tags', 'me-and-the-corner:today')
Task task = project.tasks.getByName('rspec')
String output = captureStdout {
task.run()
}
expect:
output.contains( '4 examples, 0 failures' )
}
}