Skip to content

Commit

Permalink
Merge pull request #536 from davidnortonjr/master
Browse files Browse the repository at this point in the history
  • Loading branch information
leonard84 committed Oct 18, 2015
2 parents 32606d0 + 980e9f2 commit 356584c
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ public void visitFeatureAnnotation(IgnoreIf annotation, FeatureInfo feature) {
private void doVisit(IgnoreIf annotation, ISkippable skippable) {
Closure condition = createCondition(annotation.value());
Object result = evaluateCondition(condition);
skippable.setSkipped(GroovyRuntimeUtil.isTruthy(result));
if (GroovyRuntimeUtil.isTruthy(result)) {
skippable.setSkipped(true);
}
}

private Closure createCondition(Class<? extends Closure> clazz) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ public void visitFeatureAnnotation(Requires annotation, FeatureInfo feature) {
private void doVisit(Requires annotation, ISkippable skippable) {
Closure condition = createCondition(annotation.value());
Object result = evaluateCondition(condition);
skippable.setSkipped(!GroovyRuntimeUtil.isTruthy(result));
if (!GroovyRuntimeUtil.isTruthy(result)) {
skippable.setSkipped(true);
}
}

private Closure createCondition(Class<? extends Closure> clazz) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ class IgnoreIfExtension extends Specification {
def "provides access to system properties"() {
expect: false
}

@Issue("https://github.com/spockframework/spock/issues/535")
@Requires({ false })
@IgnoreIf({ false })
def "allows determinate use of multiple filters" () {
expect: false
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import org.spockframework.VerifyExecution
import org.spockframework.ExecutionLog

import spock.lang.Specification
import spock.lang.IgnoreIf
import spock.lang.Issue
import spock.lang.Requires

@VerifyExecution
Expand Down Expand Up @@ -54,11 +56,18 @@ class RequiresExtension extends Specification {
expect: true
}

@Issue("https://github.com/spockframework/spock/issues/535")
@IgnoreIf({ true })
@Requires({ true })
def "allows determinate use of multiple filters" () {
expect: false
}

def verifyExecution(ExecutionLog log) {
expect:
log.passed.size() == 5
log.failed.size() == 0
log.skipped == ["skips feature if precondition is not satisfied"]
log.skipped == ["skips feature if precondition is not satisfied", "allows determinate use of multiple filters"]
}
}

Expand Down

0 comments on commit 356584c

Please sign in to comment.